{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "# 交叉网格搜索\n",
    "from sklearn.model_selection import GridSearchCV, cross_val_score\n",
    "\n",
    "import sklearn.ensemble as ensemble\n",
    "\n",
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "import sklearn.utils as su"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getLevelFiveData(count, startIndex):\n",
    "    data_set = []\n",
    "    data_max_min = []\n",
    "    # c_1 = np.random.randint(0, 20, count)\n",
    "    c_1 = (np.random.rand(count) * 20.0)\n",
    "    c_1_max = np.max(c_1)\n",
    "    c_1_min = np.min(c_1)\n",
    "    data_max_min.append([c_1_max, c_1_min])\n",
    "    \n",
    "    # c_2 = (np.random.randint(95, size=count) / 100)\n",
    "    c_2 = (np.random.rand(count) * 8.55 + 0.95)\n",
    "    c_2_max = np.max(c_2)\n",
    "    c_2_min = np.min(c_2)\n",
    "    data_max_min.append([c_2_max, c_2_min])\n",
    "    \n",
    "    #c_3 = np.random.randint(low=80, size=count)\n",
    "    c_3 = (np.random.rand(count) * 720 + 80)\n",
    "    c_3_max = np.max(c_3)\n",
    "    c_3_min = np.min(c_3)\n",
    "    data_max_min.append([c_3_max, c_3_min])\n",
    "    \n",
    "    #c_4 = np.random.randint(low=5000, size=count)\n",
    "    c_4 = (np.random.rand(count) * 45000 + 5000)\n",
    "    c_4_max = np.max(c_4)\n",
    "    c_4_min = np.min(c_4)\n",
    "    data_max_min.append([c_4_max, c_4_min])\n",
    "    \n",
    "    #c_5 = np.random.randint(95, 100, count)\n",
    "    c_5 = (np.random.rand(count) * 855 + 95)\n",
    "    c_5_max = np.max(c_5)\n",
    "    c_5_min = np.min(c_5)\n",
    "    data_max_min.append([c_5_max, c_5_min])\n",
    "    \n",
    "    #c_6 = np.random.randint(95, 100, count)\n",
    "    c_6 = (np.random.rand(count) * 855 + 95)\n",
    "    c_6_max = np.max(c_6)\n",
    "    c_6_min = np.min(c_6)\n",
    "    data_max_min.append([c_6_max, c_6_min])\n",
    "    \n",
    "    #c_7 = np.random.randint(low=20, size=count)\n",
    "    c_7 = (np.random.rand(count) * 180 + 20)\n",
    "    c_7_max = np.max(c_7)\n",
    "    c_7_min = np.min(c_7)\n",
    "    data_max_min.append([c_7_max, c_7_min])\n",
    "    \n",
    "    #c_8 = np.random.randint(low=90, size=count)\n",
    "    c_8 = (np.random.rand(count) * 810 + 90)\n",
    "    c_8_max = np.max(c_8)\n",
    "    c_8_min = np.min(c_8)\n",
    "    data_max_min.append([c_8_max, c_8_min])\n",
    "    \n",
    "    #c_9 = np.random.randint(low=90, size=count)\n",
    "    c_9 = (np.random.rand(count) * 810 + 90)\n",
    "    c_9_max = np.max(c_9)\n",
    "    c_9_min = np.min(c_9)\n",
    "    data_max_min.append([c_9_max, c_9_min])\n",
    "    \n",
    "    #c_10 = np.random.randint(0, 2, count)\n",
    "    c_10 = (np.random.rand(count) * 1.8 + 0.2)\n",
    "    c_10_max = np.max(c_10)\n",
    "    c_10_min = np.min(c_10)\n",
    "    data_max_min.append([c_10_max, c_10_min])\n",
    "    \n",
    "    #c_11 = np.random.randint(low=80, size=count)\n",
    "    c_11 = (np.random.rand(count) * 720 + 80)\n",
    "    c_11_max = np.max(c_11)\n",
    "    c_11_min = np.min(c_11)\n",
    "    data_max_min.append([c_11_max, c_11_min])\n",
    "    \n",
    "    #c_12 = np.random.randint(0, 10, count)\n",
    "    c_12 = (np.random.rand(count) * 9 + 1)\n",
    "    c_12_max = np.max(c_12)\n",
    "    c_12_min = np.min(c_12)\n",
    "    data_max_min.append([c_12_max, c_12_min])\n",
    "    \n",
    "    #c_13 = np.random.randint(90, 100, count)\n",
    "    c_13 = (np.random.rand(count) * 810 + 90)\n",
    "    c_13_max = np.max(c_13)\n",
    "    c_13_min = np.min(c_13)\n",
    "    data_max_min.append([c_13_max, c_13_min])\n",
    "    \n",
    "    #c_14 = np.random.randint(0, 20, count)\n",
    "    c_14 = (np.random.rand(count) * 18 + 2)\n",
    "    c_14_max = np.max(c_14)\n",
    "    c_14_min = np.min(c_14)\n",
    "    data_max_min.append([c_14_max, c_14_min])\n",
    "    \n",
    "    #c_15 = np.random.randint(90, 100, count)\n",
    "    c_15 = (np.random.rand(count) * 810 + 90)\n",
    "    c_15_max = np.max(c_15)\n",
    "    c_15_min = np.min(c_15)\n",
    "    data_max_min.append([c_15_max, c_15_min])\n",
    "    \n",
    "    # c_16 = np.random.randint(0.7, size=count, dtype=np.float32)\n",
    "    c_16 = (np.random.rand(count) * 6.3 + 0.7) \n",
    "    c_16_max = np.max(c_16)\n",
    "    c_16_min = np.min(c_16)\n",
    "    data_max_min.append([c_16_max, c_16_min])\n",
    "    \n",
    "    #c_17 = np.random.randint(95, 100, count)\n",
    "    c_17 = (np.random.rand(count) * 855 + 95)\n",
    "    c_17_max = np.max(c_17)\n",
    "    c_17_min = np.min(c_17)\n",
    "    data_max_min.append([c_17_max, c_17_min])\n",
    "    \n",
    "    #c_18 = np.random.randint(80, 100, count)\n",
    "    c_18 = (np.random.rand(count) * 720 + 80)\n",
    "    c_18_max = np.max(c_18)\n",
    "    c_18_min = np.min(c_18)\n",
    "    data_max_min.append([c_18_max, c_18_min])\n",
    "    \n",
    "    #c_19 = np.random.randint(90, 100, count)\n",
    "    c_19 = (np.random.rand(count) * 810 + 90)\n",
    "    c_19_max = np.max(c_19)\n",
    "    c_19_min = np.min(c_19)\n",
    "    data_max_min.append([c_19_max, c_19_min])\n",
    "    \n",
    "    #c_20 = np.random.randint(90, 100, count)\n",
    "    c_20 = (np.random.rand(count) * 810 + 90)\n",
    "    c_20_max = np.max(c_20)\n",
    "    c_20_min = np.min(c_20)\n",
    "    data_max_min.append([c_20_max, c_20_min])\n",
    "    \n",
    "    #c_21 = np.random.randint(95, 100, count)\n",
    "    c_21 = (np.random.rand(count) * 855 + 95)\n",
    "    c_21_max = np.max(c_21)\n",
    "    c_21_min = np.min(c_21)\n",
    "    data_max_min.append([c_21_max, c_21_min])\n",
    "    \n",
    "    #c_22 = np.random.randint(90, 100, count)\n",
    "    c_22 = (np.random.rand(count) * 810 + 90)\n",
    "    c_22_max = np.max(c_22)\n",
    "    c_22_min = np.min(c_22)\n",
    "    data_max_min.append([c_22_max, c_22_min])\n",
    "    \n",
    "    #c_23 = np.random.randint(80, 100, count)\n",
    "    c_23 = (np.random.rand(count) * 720 + 80)\n",
    "    c_23_max = np.max(c_23)\n",
    "    c_23_min = np.min(c_23)\n",
    "    data_max_min.append([c_23_max, c_23_min])\n",
    "    \n",
    "    #c_24 = np.random.randint(90, 100, count)\n",
    "    c_24 = (np.random.rand(count) * 810 + 90)\n",
    "    c_24_max = np.max(c_24)\n",
    "    c_24_min = np.min(c_24)\n",
    "    data_max_min.append([c_24_max, c_24_min])\n",
    "\n",
    "    \n",
    "    for i in range(count):\n",
    "        data_row = []\n",
    "        data_row.append(startIndex + i)\n",
    "        data_row.append(float(c_1[i]))\n",
    "        data_row.append(float(c_2[i]))\n",
    "        data_row.append(float(c_3[i]))\n",
    "        data_row.append(float(c_4[i]))\n",
    "        data_row.append(float(c_5[i]))\n",
    "        data_row.append(float(c_6[i]))\n",
    "        data_row.append(float(c_7[i]))\n",
    "        data_row.append(float(c_8[i]))\n",
    "        data_row.append(float(c_9[i]))\n",
    "        data_row.append(float(c_10[i]))\n",
    "        data_row.append(float(c_11[i]))\n",
    "        data_row.append(float(c_12[i]))\n",
    "        data_row.append(float(c_13[i]))\n",
    "        data_row.append(float(c_14[i]))\n",
    "        data_row.append(float(c_15[i]))\n",
    "        data_row.append(float(c_16[i]))\n",
    "        data_row.append(float(c_17[i]))\n",
    "        data_row.append(float(c_18[i]))\n",
    "        data_row.append(float(c_19[i]))\n",
    "        data_row.append(float(c_20[i]))\n",
    "        data_row.append(float(c_21[i]))\n",
    "        data_row.append(float(c_22[i]))\n",
    "        data_row.append(float(c_23[i]))\n",
    "        data_row.append(float(c_24[i]))\n",
    "        data_row.append(5.0)\n",
    "        data_set.append(data_row)\n",
    "    return (data_set, data_max_min)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getLevelFiveData_v2(count, startIndex):\n",
    "    data_set = []\n",
    "    data_max_min = []\n",
    "    # c_1 = np.random.randint(0, 20, count)\n",
    "    c_1 = (np.random.rand(count) * 20.0)\n",
    "    c_1_max = np.max(c_1)\n",
    "    c_1_min = np.min(c_1)\n",
    "    data_max_min.append([c_1_max, c_1_min])\n",
    "    \n",
    "    # c_2 = (np.random.randint(95, size=count) / 100)\n",
    "    c_2 = (np.random.rand(count) * 8.55 + 0.95)\n",
    "    c_2_max = np.max(c_2)\n",
    "    c_2_min = np.min(c_2)\n",
    "    data_max_min.append([c_2_max, c_2_min])\n",
    "    \n",
    "    #c_3 = np.random.randint(low=80, size=count)\n",
    "    c_3 = (np.random.rand(count) * 720 + 80)\n",
    "    c_3_max = np.max(c_3)\n",
    "    c_3_min = np.min(c_3)\n",
    "    data_max_min.append([c_3_max, c_3_min])\n",
    "    \n",
    "    #c_4 = np.random.randint(low=5000, size=count)\n",
    "    c_4 = (np.random.rand(count) * 45000 + 5000)\n",
    "    c_4_max = np.max(c_4)\n",
    "    c_4_min = np.min(c_4)\n",
    "    data_max_min.append([c_4_max, c_4_min])\n",
    "    \n",
    "    #c_5 = np.random.randint(95, 100, count)\n",
    "    c_5 = (np.random.rand(count) * 855 + 95)\n",
    "    c_5_max = np.max(c_5)\n",
    "    c_5_min = np.min(c_5)\n",
    "    data_max_min.append([c_5_max, c_5_min])\n",
    "    \n",
    "    #c_6 = np.random.randint(95, 100, count)\n",
    "    c_6 = (np.random.rand(count) * 855 + 95)\n",
    "    c_6_max = np.max(c_6)\n",
    "    c_6_min = np.min(c_6)\n",
    "    data_max_min.append([c_6_max, c_6_min])\n",
    "    \n",
    "    #c_7 = np.random.randint(low=20, size=count)\n",
    "    c_7 = (np.random.rand(count) * 180 + 20)\n",
    "    c_7_max = np.max(c_7)\n",
    "    c_7_min = np.min(c_7)\n",
    "    data_max_min.append([c_7_max, c_7_min])\n",
    "    \n",
    "    #c_8 = np.random.randint(low=90, size=count)\n",
    "    c_8 = (np.random.rand(count) * 810 + 90)\n",
    "    c_8_max = np.max(c_8)\n",
    "    c_8_min = np.min(c_8)\n",
    "    data_max_min.append([c_8_max, c_8_min])\n",
    "    \n",
    "    #c_9 = np.random.randint(low=90, size=count)\n",
    "    c_9 = (np.random.rand(count) * 810 + 90)\n",
    "    c_9_max = np.max(c_9)\n",
    "    c_9_min = np.min(c_9)\n",
    "    data_max_min.append([c_9_max, c_9_min])\n",
    "    \n",
    "    #c_10 = np.random.randint(0, 2, count)\n",
    "    c_10 = (np.random.rand(count) * 1.8 + 0.2)\n",
    "    c_10_max = np.max(c_10)\n",
    "    c_10_min = np.min(c_10)\n",
    "    data_max_min.append([c_10_max, c_10_min])\n",
    "    \n",
    "    #c_11 = np.random.randint(low=80, size=count)\n",
    "    c_11 = (np.random.rand(count) * 720 + 80)\n",
    "    c_11_max = np.max(c_11)\n",
    "    c_11_min = np.min(c_11)\n",
    "    data_max_min.append([c_11_max, c_11_min])\n",
    "    \n",
    "    #c_12 = np.random.randint(0, 10, count)\n",
    "    c_12 = (np.random.rand(count) * 9 + 1)\n",
    "    c_12_max = np.max(c_12)\n",
    "    c_12_min = np.min(c_12)\n",
    "    data_max_min.append([c_12_max, c_12_min])\n",
    "    \n",
    "    #c_13 = np.random.randint(90, 100, count)\n",
    "    c_13 = (np.random.rand(count) * 810 + 90)\n",
    "    c_13_max = np.max(c_13)\n",
    "    c_13_min = np.min(c_13)\n",
    "    data_max_min.append([c_13_max, c_13_min])\n",
    "    \n",
    "    #c_14 = np.random.randint(0, 20, count)\n",
    "    c_14 = (np.random.rand(count) * 18 + 2)\n",
    "    c_14_max = np.max(c_14)\n",
    "    c_14_min = np.min(c_14)\n",
    "    data_max_min.append([c_14_max, c_14_min])\n",
    "    \n",
    "    #c_15 = np.random.randint(90, 100, count)\n",
    "    c_15 = (np.random.rand(count) * 810 + 90)\n",
    "    c_15_max = np.max(c_15)\n",
    "    c_15_min = np.min(c_15)\n",
    "    data_max_min.append([c_15_max, c_15_min])\n",
    "    \n",
    "    # c_16 = np.random.randint(0.7, size=count, dtype=np.float32)\n",
    "    c_16 = (np.random.rand(count) * 6.3 + 0.7) \n",
    "    c_16_max = np.max(c_16)\n",
    "    c_16_min = np.min(c_16)\n",
    "    data_max_min.append([c_16_max, c_16_min])\n",
    "    \n",
    "    #c_17 = np.random.randint(95, 100, count)\n",
    "    c_17 = (np.random.rand(count) * 855 + 95)\n",
    "    c_17_max = np.max(c_17)\n",
    "    c_17_min = np.min(c_17)\n",
    "    data_max_min.append([c_17_max, c_17_min])\n",
    "    \n",
    "    #c_18 = np.random.randint(80, 100, count)\n",
    "    c_18 = (np.random.rand(count) * 720 + 80)\n",
    "    c_18_max = np.max(c_18)\n",
    "    c_18_min = np.min(c_18)\n",
    "    data_max_min.append([c_18_max, c_18_min])\n",
    "    \n",
    "    #c_19 = np.random.randint(90, 100, count)\n",
    "    c_19 = (np.random.rand(count) * 810 + 90)\n",
    "    c_19_max = np.max(c_19)\n",
    "    c_19_min = np.min(c_19)\n",
    "    data_max_min.append([c_19_max, c_19_min])\n",
    "    \n",
    "    #c_20 = np.random.randint(90, 100, count)\n",
    "    c_20 = (np.random.rand(count) * 810 + 90)\n",
    "    c_20_max = np.max(c_20)\n",
    "    c_20_min = np.min(c_20)\n",
    "    data_max_min.append([c_20_max, c_20_min])\n",
    "    \n",
    "    #c_21 = np.random.randint(95, 100, count)\n",
    "    c_21 = (np.random.rand(count) * 855 + 95)\n",
    "    c_21_max = np.max(c_21)\n",
    "    c_21_min = np.min(c_21)\n",
    "    data_max_min.append([c_21_max, c_21_min])\n",
    "    \n",
    "    #c_22 = np.random.randint(90, 100, count)\n",
    "    c_22 = (np.random.rand(count) * 810 + 90)\n",
    "    c_22_max = np.max(c_22)\n",
    "    c_22_min = np.min(c_22)\n",
    "    data_max_min.append([c_22_max, c_22_min])\n",
    "    \n",
    "    #c_23 = np.random.randint(80, 100, count)\n",
    "    c_23 = (np.random.rand(count) * 720 + 80)\n",
    "    c_23_max = np.max(c_23)\n",
    "    c_23_min = np.min(c_23)\n",
    "    data_max_min.append([c_23_max, c_23_min])\n",
    "    \n",
    "    #c_24 = np.random.randint(90, 100, count)\n",
    "    c_24 = (np.random.rand(count) * 810 + 90)\n",
    "    c_24_max = np.max(c_24)\n",
    "    c_24_min = np.min(c_24)\n",
    "    data_max_min.append([c_24_max, c_24_min])\n",
    "\n",
    "    \n",
    "    for i in range(count):\n",
    "        data_row = []\n",
    "        data_row.append(startIndex + i)\n",
    "        data_row.append(float(c_1[i]))\n",
    "        data_row.append(float(c_2[i]))\n",
    "        data_row.append(float(c_3[i]))\n",
    "        data_row.append(float(c_4[i]))\n",
    "        data_row.append(float(c_5[i]))\n",
    "        data_row.append(float(c_6[i]))\n",
    "        data_row.append(float(c_7[i]))\n",
    "        data_row.append(float(c_8[i]))\n",
    "        data_row.append(float(c_9[i]))\n",
    "        data_row.append(float(c_10[i]))\n",
    "        data_row.append(float(c_11[i]))\n",
    "        data_row.append(float(c_12[i]))\n",
    "        data_row.append(float(c_13[i]))\n",
    "        data_row.append(float(c_14[i]))\n",
    "        data_row.append(float(c_15[i]))\n",
    "        data_row.append(float(c_16[i]))\n",
    "        data_row.append(float(c_17[i]))\n",
    "        data_row.append(float(c_18[i]))\n",
    "        data_row.append(float(c_19[i]))\n",
    "        data_row.append(float(c_20[i]))\n",
    "        data_row.append(float(c_21[i]))\n",
    "        data_row.append(float(c_22[i]))\n",
    "        data_row.append(float(c_23[i]))\n",
    "        data_row.append(float(c_24[i]))\n",
    "        data_row.append(5)\n",
    "        data_set.append(data_row)\n",
    "    return (data_set, data_max_min)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getLevelFourData(count, startIndex):\n",
    "    data_set = []\n",
    "    data_max_min = []\n",
    "    c_1 = np.random.randint(20, 40, size=count)\n",
    "    c_1_max = np.max(c_1)\n",
    "    c_1_min = np.min(c_1)\n",
    "    data_max_min.append([c_1_max, c_1_min])\n",
    "    \n",
    "    # c_2 = (np.random.randint(90, 95, size=count) / 100)\n",
    "    c_2 = (np.random.rand(count) * 0.05 + 0.9)\n",
    "    c_2_max = np.max(c_2)\n",
    "    c_2_min = np.min(c_2)\n",
    "    data_max_min.append([c_2_max, c_2_min])\n",
    "    \n",
    "    c_3 = np.random.randint(60, 80, count)\n",
    "    c_3_max = np.max(c_3)\n",
    "    c_3_min = np.min(c_3)\n",
    "    data_max_min.append([c_3_max, c_3_min])\n",
    "    \n",
    "    c_4 = np.random.randint(4000, 5000, count)\n",
    "    c_4_max = np.max(c_4)\n",
    "    c_4_min = np.min(c_4)\n",
    "    data_max_min.append([c_4_max, c_4_min])\n",
    "    \n",
    "    c_5 = np.random.randint(80, 95, count)\n",
    "    c_5_max = np.max(c_5)\n",
    "    c_5_min = np.min(c_5)\n",
    "    data_max_min.append([c_5_max, c_5_min])\n",
    "    \n",
    "    c_6 = np.random.randint(80, 95, count)\n",
    "    c_6_max = np.max(c_6)\n",
    "    c_6_min = np.min(c_6)\n",
    "    data_max_min.append([c_6_max, c_6_min])\n",
    "    \n",
    "    c_7 = np.random.randint(15, 20, count)\n",
    "    c_7_max = np.max(c_7)\n",
    "    c_7_min = np.min(c_7)\n",
    "    data_max_min.append([c_7_max, c_7_min])\n",
    "    \n",
    "    c_8 = np.random.randint(75, 90, count)\n",
    "    c_8_max = np.max(c_8)\n",
    "    c_8_min = np.min(c_8)\n",
    "    data_max_min.append([c_8_max, c_8_min])\n",
    "    \n",
    "    c_9 = np.random.randint(80, 90, count)\n",
    "    c_9_max = np.max(c_9)\n",
    "    c_9_min = np.min(c_9)\n",
    "    data_max_min.append([c_9_max, c_9_min])\n",
    "    \n",
    "    c_10 = np.random.randint(2, 4, count)\n",
    "    c_10_max = np.max(c_10)\n",
    "    c_10_min = np.min(c_10)\n",
    "    data_max_min.append([c_10_max, c_10_min])\n",
    "    \n",
    "    c_11 = np.random.randint(60, 80, count)\n",
    "    c_11_max = np.max(c_11)\n",
    "    c_11_min = np.min(c_11)\n",
    "    data_max_min.append([c_11_max, c_11_min])\n",
    "    \n",
    "    c_12 = np.random.randint(10, 20, count)\n",
    "    c_12_max = np.max(c_12)\n",
    "    c_12_min = np.min(c_12)\n",
    "    data_max_min.append([c_12_max, c_12_min])\n",
    "    \n",
    "    c_13 = np.random.randint(80, 90, count)\n",
    "    c_13_max = np.max(c_13)\n",
    "    c_13_min = np.min(c_13)\n",
    "    data_max_min.append([c_13_max, c_13_min])\n",
    "    \n",
    "    c_14 = np.random.randint(20, 40, count)\n",
    "    c_14_max = np.max(c_14)\n",
    "    c_14_min = np.min(c_14)\n",
    "    data_max_min.append([c_14_max, c_14_min])\n",
    "    \n",
    "    c_15 = np.random.randint(80, 90, count)\n",
    "    c_15_max = np.max(c_15)\n",
    "    c_15_min = np.min(c_15)\n",
    "    data_max_min.append([c_15_max, c_15_min])\n",
    "    \n",
    "    # c_16 = np.random.randint(60, 70, size=count, dtype=np.float32)\n",
    "    c_16 = (np.random.rand(count) * 0.1 + 0.6)\n",
    "    c_16_max = np.max(c_16)\n",
    "    c_16_min = np.min(c_16)\n",
    "    data_max_min.append([c_16_max, c_16_min])\n",
    "    \n",
    "    c_17 = np.random.randint(80, 95, count)\n",
    "    c_17_max = np.max(c_17)\n",
    "    c_17_min = np.min(c_17)\n",
    "    data_max_min.append([c_17_max, c_17_min])\n",
    "    \n",
    "    c_18 = np.random.randint(60, 80, count)\n",
    "    c_18_max = np.max(c_18)\n",
    "    c_18_min = np.min(c_18)\n",
    "    data_max_min.append([c_18_max, c_18_min])\n",
    "    \n",
    "    c_19 = np.random.randint(80, 90, count)\n",
    "    c_19_max = np.max(c_19)\n",
    "    c_19_min = np.min(c_19)\n",
    "    data_max_min.append([c_19_max, c_19_min])\n",
    "    \n",
    "    c_20 = np.random.randint(80, 90, count)\n",
    "    c_20_max = np.max(c_20)\n",
    "    c_20_min = np.min(c_20)\n",
    "    data_max_min.append([c_20_max, c_20_min])\n",
    "    \n",
    "    c_21 = np.random.randint(85, 95, count)\n",
    "    c_21_max = np.max(c_21)\n",
    "    c_21_min = np.min(c_21)\n",
    "    data_max_min.append([c_21_max, c_21_min])\n",
    "    \n",
    "    c_22 = np.random.randint(80, 90, count)\n",
    "    c_22_max = np.max(c_22)\n",
    "    c_22_min = np.min(c_22)\n",
    "    data_max_min.append([c_22_max, c_22_min])\n",
    "    \n",
    "    c_23 = np.random.randint(60, 80, count)\n",
    "    c_23_max = np.max(c_23)\n",
    "    c_23_min = np.min(c_23)\n",
    "    data_max_min.append([c_23_max, c_23_min])\n",
    "    \n",
    "    c_24 = np.random.randint(80, 90, count)\n",
    "    c_24_max = np.max(c_24)\n",
    "    c_24_min = np.min(c_24)\n",
    "    data_max_min.append([c_24_max, c_24_min])\n",
    "\n",
    "    for i in range(count):\n",
    "        data_row = []\n",
    "        data_row.append(startIndex + i)\n",
    "        data_row.append(float(c_1[i]))\n",
    "        data_row.append(float(c_2[i]))\n",
    "        data_row.append(float(c_3[i]))\n",
    "        data_row.append(float(c_4[i]))\n",
    "        data_row.append(float(c_5[i]))\n",
    "        data_row.append(float(c_6[i]))\n",
    "        data_row.append(float(c_7[i]))\n",
    "        data_row.append(float(c_8[i]))\n",
    "        data_row.append(float(c_9[i]))\n",
    "        data_row.append(float(c_10[i]))\n",
    "        data_row.append(float(c_11[i]))\n",
    "        data_row.append(float(c_12[i]))\n",
    "        data_row.append(float(c_13[i]))\n",
    "        data_row.append(float(c_14[i]))\n",
    "        data_row.append(float(c_15[i]))\n",
    "        data_row.append(float(c_16[i]))\n",
    "        data_row.append(float(c_17[i]))\n",
    "        data_row.append(float(c_18[i]))\n",
    "        data_row.append(float(c_19[i]))\n",
    "        data_row.append(float(c_20[i]))\n",
    "        data_row.append(float(c_21[i]))\n",
    "        data_row.append(float(c_22[i]))\n",
    "        data_row.append(float(c_23[i]))\n",
    "        data_row.append(float(c_24[i]))\n",
    "        data_row.append(4.0)\n",
    "        data_set.append(data_row)\n",
    "    return (data_set, data_max_min)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getLevelFourData_v2(count, startIndex):\n",
    "    data_set = []\n",
    "    data_max_min = []\n",
    "    #c_1 = np.random.randint(20, 40, size=count)\n",
    "    c_1 = (np.random.rand(count) * 20 + 20)\n",
    "    c_1_max = np.max(c_1)\n",
    "    c_1_min = np.min(c_1)\n",
    "    data_max_min.append([c_1_max, c_1_min])\n",
    "    \n",
    "    # c_2 = (np.random.randint(90, 95, size=count) / 100)\n",
    "    #c_2 = (np.random.rand(count) * 0.05 + 0.9)\n",
    "    c_2 = (np.random.rand(count) * 0.05 + 0.9)\n",
    "    c_2_max = np.max(c_2)\n",
    "    c_2_min = np.min(c_2)\n",
    "    data_max_min.append([c_2_max, c_2_min])\n",
    "    \n",
    "    #c_3 = np.random.randint(60, 80, count)\n",
    "    c_3 = (np.random.rand(count) * 20 + 60)\n",
    "    c_3_max = np.max(c_3)\n",
    "    c_3_min = np.min(c_3)\n",
    "    data_max_min.append([c_3_max, c_3_min])\n",
    "    \n",
    "    #c_4 = np.random.randint(4000, 5000, count)\n",
    "    c_4 = (np.random.rand(count) * 1000 + 4000)\n",
    "    c_4_max = np.max(c_4)\n",
    "    c_4_min = np.min(c_4)\n",
    "    data_max_min.append([c_4_max, c_4_min])\n",
    "    \n",
    "    #c_5 = np.random.randint(80, 95, count)\n",
    "    c_5 = (np.random.rand(count) * 15 + 80)\n",
    "    c_5_max = np.max(c_5)\n",
    "    c_5_min = np.min(c_5)\n",
    "    data_max_min.append([c_5_max, c_5_min])\n",
    "    \n",
    "    #c_6 = np.random.randint(80, 95, count)\n",
    "    c_6 = (np.random.rand(count) * 15 + 80)\n",
    "    c_6_max = np.max(c_6)\n",
    "    c_6_min = np.min(c_6)\n",
    "    data_max_min.append([c_6_max, c_6_min])\n",
    "    \n",
    "    #c_7 = np.random.randint(15, 20, count)\n",
    "    c_7 = (np.random.rand(count) * 5 + 15)\n",
    "    c_7_max = np.max(c_7)\n",
    "    c_7_min = np.min(c_7)\n",
    "    data_max_min.append([c_7_max, c_7_min])\n",
    "    \n",
    "    #c_8 = np.random.randint(75, 90, count)\n",
    "    c_8 = (np.random.rand(count) * 15 + 75)\n",
    "    c_8_max = np.max(c_8)\n",
    "    c_8_min = np.min(c_8)\n",
    "    data_max_min.append([c_8_max, c_8_min])\n",
    "    \n",
    "    #c_9 = np.random.randint(80, 90, count)\n",
    "    c_9 = (np.random.rand(count) * 10 + 80)\n",
    "    c_9_max = np.max(c_9)\n",
    "    c_9_min = np.min(c_9)\n",
    "    data_max_min.append([c_9_max, c_9_min])\n",
    "    \n",
    "    #c_10 = np.random.randint(2, 4, count)\n",
    "    c_10 = (np.random.rand(count) * 2 + 2)\n",
    "    c_10_max = np.max(c_10)\n",
    "    c_10_min = np.min(c_10)\n",
    "    data_max_min.append([c_10_max, c_10_min])\n",
    "    \n",
    "    #c_11 = np.random.randint(60, 80, count)\n",
    "    c_11 = (np.random.rand(count) * 20 + 60)\n",
    "    c_11_max = np.max(c_11)\n",
    "    c_11_min = np.min(c_11)\n",
    "    data_max_min.append([c_11_max, c_11_min])\n",
    "    \n",
    "    #c_12 = np.random.randint(10, 20, count)\n",
    "    c_12 = (np.random.rand(count) * 10 + 10)\n",
    "    c_12_max = np.max(c_12)\n",
    "    c_12_min = np.min(c_12)\n",
    "    data_max_min.append([c_12_max, c_12_min])\n",
    "    \n",
    "    #c_13 = np.random.randint(80, 90, count)\n",
    "    c_13 = (np.random.rand(count) * 10 + 80)\n",
    "    c_13_max = np.max(c_13)\n",
    "    c_13_min = np.min(c_13)\n",
    "    data_max_min.append([c_13_max, c_13_min])\n",
    "    \n",
    "    #c_14 = np.random.randint(20, 40, count)\n",
    "    c_14 = (np.random.rand(count) * 20 + 20)\n",
    "    c_14_max = np.max(c_14)\n",
    "    c_14_min = np.min(c_14)\n",
    "    data_max_min.append([c_14_max, c_14_min])\n",
    "    \n",
    "    #c_15 = np.random.randint(80, 90, count)\n",
    "    c_15 = (np.random.rand(count) * 10 + 80)\n",
    "    c_15_max = np.max(c_15)\n",
    "    c_15_min = np.min(c_15)\n",
    "    data_max_min.append([c_15_max, c_15_min])\n",
    "    \n",
    "    # c_16 = np.random.randint(60, 70, size=count, dtype=np.float32)\n",
    "    #c_16 = (np.random.rand(count) * 0.1 + 0.6)\n",
    "    c_16 = (np.random.rand(count) * 0.1 + 0.6)\n",
    "    c_16_max = np.max(c_16)\n",
    "    c_16_min = np.min(c_16)\n",
    "    data_max_min.append([c_16_max, c_16_min])\n",
    "    \n",
    "    #c_17 = np.random.randint(80, 95, count)\n",
    "    c_17 = (np.random.rand(count) * 15 + 80)\n",
    "    c_17_max = np.max(c_17)\n",
    "    c_17_min = np.min(c_17)\n",
    "    data_max_min.append([c_17_max, c_17_min])\n",
    "    \n",
    "    #c_18 = np.random.randint(60, 80, count)\n",
    "    c_18 = (np.random.rand(count) * 20 + 60)\n",
    "    c_18_max = np.max(c_18)\n",
    "    c_18_min = np.min(c_18)\n",
    "    data_max_min.append([c_18_max, c_18_min])\n",
    "    \n",
    "    #c_19 = np.random.randint(80, 90, count)\n",
    "    c_19 = (np.random.rand(count) * 10 + 80)\n",
    "    c_19_max = np.max(c_19)\n",
    "    c_19_min = np.min(c_19)\n",
    "    data_max_min.append([c_19_max, c_19_min])\n",
    "    \n",
    "    #c_20 = np.random.randint(80, 90, count)\n",
    "    c_20 = (np.random.rand(count) * 10 + 80)\n",
    "    c_20_max = np.max(c_20)\n",
    "    c_20_min = np.min(c_20)\n",
    "    data_max_min.append([c_20_max, c_20_min])\n",
    "    \n",
    "    #c_21 = np.random.randint(85, 95, count)\n",
    "    c_21 = (np.random.rand(count) * 10 + 85)\n",
    "    c_21_max = np.max(c_21)\n",
    "    c_21_min = np.min(c_21)\n",
    "    data_max_min.append([c_21_max, c_21_min])\n",
    "    \n",
    "    #c_22 = np.random.randint(80, 90, count)\n",
    "    c_22 = (np.random.rand(count) * 10 + 80)\n",
    "    c_22_max = np.max(c_22)\n",
    "    c_22_min = np.min(c_22)\n",
    "    data_max_min.append([c_22_max, c_22_min])\n",
    "    \n",
    "    #c_23 = np.random.randint(60, 80, count)\n",
    "    c_23 = (np.random.rand(count) * 20 + 60)\n",
    "    c_23_max = np.max(c_23)\n",
    "    c_23_min = np.min(c_23)\n",
    "    data_max_min.append([c_23_max, c_23_min])\n",
    "    \n",
    "    #c_24 = np.random.randint(80, 90, count)\n",
    "    c_24 = (np.random.rand(count) * 10 + 80)\n",
    "    c_24_max = np.max(c_24)\n",
    "    c_24_min = np.min(c_24)\n",
    "    data_max_min.append([c_24_max, c_24_min])\n",
    "\n",
    "    for i in range(count):\n",
    "        data_row = []\n",
    "        data_row.append(startIndex + i)\n",
    "        data_row.append(float(c_1[i]))\n",
    "        data_row.append(float(c_2[i]))\n",
    "        data_row.append(float(c_3[i]))\n",
    "        data_row.append(float(c_4[i]))\n",
    "        data_row.append(float(c_5[i]))\n",
    "        data_row.append(float(c_6[i]))\n",
    "        data_row.append(float(c_7[i]))\n",
    "        data_row.append(float(c_8[i]))\n",
    "        data_row.append(float(c_9[i]))\n",
    "        data_row.append(float(c_10[i]))\n",
    "        data_row.append(float(c_11[i]))\n",
    "        data_row.append(float(c_12[i]))\n",
    "        data_row.append(float(c_13[i]))\n",
    "        data_row.append(float(c_14[i]))\n",
    "        data_row.append(float(c_15[i]))\n",
    "        data_row.append(float(c_16[i]))\n",
    "        data_row.append(float(c_17[i]))\n",
    "        data_row.append(float(c_18[i]))\n",
    "        data_row.append(float(c_19[i]))\n",
    "        data_row.append(float(c_20[i]))\n",
    "        data_row.append(float(c_21[i]))\n",
    "        data_row.append(float(c_22[i]))\n",
    "        data_row.append(float(c_23[i]))\n",
    "        data_row.append(float(c_24[i]))\n",
    "        data_row.append(4)\n",
    "        data_set.append(data_row)\n",
    "    return (data_set, data_max_min)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getLevelThreeData(count, startIndex):\n",
    "    data_set = []\n",
    "    data_max_min = []\n",
    "    c_1 = np.random.randint(40, 60, size=count)\n",
    "    c_1_max = np.max(c_1)\n",
    "    c_1_min = np.min(c_1)\n",
    "    data_max_min.append([c_1_max, c_1_min])\n",
    "    \n",
    "    # c_2 = (np.random.randint(90, 95, size=count) / 100)\n",
    "    c_2 = (np.random.rand(count) * 0.05 + 0.85)\n",
    "    c_2_max = np.max(c_2)\n",
    "    c_2_min = np.min(c_2)\n",
    "    data_max_min.append([c_2_max, c_2_min])\n",
    "    \n",
    "    c_3 = np.random.randint(40, 60, count)\n",
    "    c_3_max = np.max(c_3)\n",
    "    c_3_min = np.min(c_3)\n",
    "    data_max_min.append([c_3_max, c_3_min])\n",
    "    \n",
    "    c_4 = np.random.randint(3000, 4000, count)\n",
    "    c_4_max = np.max(c_4)\n",
    "    c_4_min = np.min(c_4)\n",
    "    data_max_min.append([c_4_max, c_4_min])\n",
    "    \n",
    "    c_5 = np.random.randint(60, 80, count)\n",
    "    c_5_max = np.max(c_5)\n",
    "    c_5_min = np.min(c_5)\n",
    "    data_max_min.append([c_5_max, c_5_min])\n",
    "    \n",
    "    c_6 = np.random.randint(60, 80, count)\n",
    "    c_6_max = np.max(c_6)\n",
    "    c_6_min = np.min(c_6)\n",
    "    data_max_min.append([c_6_max, c_6_min])\n",
    "    \n",
    "    c_7 = np.random.randint(10, 15, count)\n",
    "    c_7_max = np.max(c_7)\n",
    "    c_7_min = np.min(c_7)\n",
    "    data_max_min.append([c_7_max, c_7_min])\n",
    "    \n",
    "    c_8 = np.random.randint(60, 75, count)\n",
    "    c_8_max = np.max(c_8)\n",
    "    c_8_min = np.min(c_8)\n",
    "    data_max_min.append([c_8_max, c_8_min])\n",
    "    \n",
    "    c_9 = np.random.randint(70, 80, count)\n",
    "    c_9_max = np.max(c_9)\n",
    "    c_9_min = np.min(c_9)\n",
    "    data_max_min.append([c_9_max, c_9_min])\n",
    "    \n",
    "    c_10 = np.random.randint(4, 6, count)\n",
    "    c_10_max = np.max(c_10)\n",
    "    c_10_min = np.min(c_10)\n",
    "    data_max_min.append([c_10_max, c_10_min])\n",
    "    \n",
    "    c_11 = np.random.randint(40, 60, count)\n",
    "    c_11_max = np.max(c_11)\n",
    "    c_11_min = np.min(c_11)\n",
    "    data_max_min.append([c_11_max, c_11_min])\n",
    "    \n",
    "    c_12 = np.random.randint(20, 40, count)\n",
    "    c_12_max = np.max(c_12)\n",
    "    c_12_min = np.min(c_12)\n",
    "    data_max_min.append([c_12_max, c_12_min])\n",
    "    \n",
    "    c_13 = np.random.randint(70, 80, count)\n",
    "    c_13_max = np.max(c_13)\n",
    "    c_13_min = np.min(c_13)\n",
    "    data_max_min.append([c_13_max, c_13_min])\n",
    "    \n",
    "    c_14 = np.random.randint(40, 60, count)\n",
    "    c_14_max = np.max(c_14)\n",
    "    c_14_min = np.min(c_14)\n",
    "    data_max_min.append([c_14_max, c_14_min])\n",
    "    \n",
    "    c_15 = np.random.randint(70, 80, count)\n",
    "    c_15_max = np.max(c_15)\n",
    "    c_15_min = np.min(c_15)\n",
    "    data_max_min.append([c_15_max, c_15_min])\n",
    "    \n",
    "    # c_16 = np.random.randint(60, 70, size=count, dtype=np.float32)\n",
    "    c_16 = (np.random.rand(count) * 0.1 + 0.5)\n",
    "    c_16_max = np.max(c_16)\n",
    "    c_16_min = np.min(c_16)\n",
    "    data_max_min.append([c_16_max, c_16_min])\n",
    "    \n",
    "    c_17 = np.random.randint(60, 80, count)\n",
    "    c_17_max = np.max(c_17)\n",
    "    c_17_min = np.min(c_17)\n",
    "    data_max_min.append([c_17_max, c_17_min])\n",
    "    \n",
    "    c_18 = np.random.randint(40, 60, count)\n",
    "    c_18_max = np.max(c_18)\n",
    "    c_18_min = np.min(c_18)\n",
    "    data_max_min.append([c_18_max, c_18_min])\n",
    "    \n",
    "    c_19 = np.random.randint(70, 80, count)\n",
    "    c_19_max = np.max(c_19)\n",
    "    c_19_min = np.min(c_19)\n",
    "    data_max_min.append([c_19_max, c_19_min])\n",
    "    \n",
    "    c_20 = np.random.randint(70, 80, count)\n",
    "    c_20_max = np.max(c_20)\n",
    "    c_20_min = np.min(c_20)\n",
    "    data_max_min.append([c_20_max, c_20_min])\n",
    "    \n",
    "    c_21 = np.random.randint(70, 85, count)\n",
    "    c_21_max = np.max(c_21)\n",
    "    c_21_min = np.min(c_21)\n",
    "    data_max_min.append([c_21_max, c_21_min])\n",
    "    \n",
    "    c_22 = np.random.randint(70, 80, count)\n",
    "    c_22_max = np.max(c_22)\n",
    "    c_22_min = np.min(c_22)\n",
    "    data_max_min.append([c_22_max, c_22_min])\n",
    "    \n",
    "    c_23 = np.random.randint(40, 60, count)\n",
    "    c_23_max = np.max(c_23)\n",
    "    c_23_min = np.min(c_23)\n",
    "    data_max_min.append([c_23_max, c_23_min])\n",
    "    \n",
    "    c_24 = np.random.randint(60, 80, count)\n",
    "    c_24_max = np.max(c_24)\n",
    "    c_24_min = np.min(c_24)\n",
    "    data_max_min.append([c_24_max, c_24_min])\n",
    "\n",
    "    for i in range(count):\n",
    "        data_row = []\n",
    "        data_row.append(startIndex + i)\n",
    "        data_row.append(float(c_1[i]))\n",
    "        data_row.append(float(c_2[i]))\n",
    "        data_row.append(float(c_3[i]))\n",
    "        data_row.append(float(c_4[i]))\n",
    "        data_row.append(float(c_5[i]))\n",
    "        data_row.append(float(c_6[i]))\n",
    "        data_row.append(float(c_7[i]))\n",
    "        data_row.append(float(c_8[i]))\n",
    "        data_row.append(float(c_9[i]))\n",
    "        data_row.append(float(c_10[i]))\n",
    "        data_row.append(float(c_11[i]))\n",
    "        data_row.append(float(c_12[i]))\n",
    "        data_row.append(float(c_13[i]))\n",
    "        data_row.append(float(c_14[i]))\n",
    "        data_row.append(float(c_15[i]))\n",
    "        data_row.append(float(c_16[i]))\n",
    "        data_row.append(float(c_17[i]))\n",
    "        data_row.append(float(c_18[i]))\n",
    "        data_row.append(float(c_19[i]))\n",
    "        data_row.append(float(c_20[i]))\n",
    "        data_row.append(float(c_21[i]))\n",
    "        data_row.append(float(c_22[i]))\n",
    "        data_row.append(float(c_23[i]))\n",
    "        data_row.append(float(c_24[i]))\n",
    "        data_row.append(3.0)\n",
    "        data_set.append(data_row)\n",
    "    return (data_set, data_max_min)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getLevelThreeData_v2(count, startIndex):\n",
    "    data_set = []\n",
    "    data_max_min = []\n",
    "    #c_1 = np.random.randint(40, 60, size=count)\n",
    "    c_1 = (np.random.rand(count) * 20 + 40)\n",
    "    c_1_max = np.max(c_1)\n",
    "    c_1_min = np.min(c_1)\n",
    "    data_max_min.append([c_1_max, c_1_min])\n",
    "    \n",
    "    # c_2 = (np.random.randint(90, 95, size=count) / 100)\n",
    "    #c_2 = (np.random.rand(count) * 0.05 + 0.85)\n",
    "    c_2 = (np.random.rand(count) * 0.05 + 0.85)\n",
    "    c_2_max = np.max(c_2)\n",
    "    c_2_min = np.min(c_2)\n",
    "    data_max_min.append([c_2_max, c_2_min])\n",
    "    \n",
    "    #c_3 = np.random.randint(40, 60, count)\n",
    "    c_3 = (np.random.rand(count) * 20 + 40)\n",
    "    c_3_max = np.max(c_3)\n",
    "    c_3_min = np.min(c_3)\n",
    "    data_max_min.append([c_3_max, c_3_min])\n",
    "    \n",
    "    #c_4 = np.random.randint(3000, 4000, count)\n",
    "    c_4 = (np.random.rand(count) * 1000 + 3000)\n",
    "    c_4_max = np.max(c_4)\n",
    "    c_4_min = np.min(c_4)\n",
    "    data_max_min.append([c_4_max, c_4_min])\n",
    "    \n",
    "    #c_5 = np.random.randint(60, 80, count)\n",
    "    c_5 = (np.random.rand(count) * 20 + 60)\n",
    "    c_5_max = np.max(c_5)\n",
    "    c_5_min = np.min(c_5)\n",
    "    data_max_min.append([c_5_max, c_5_min])\n",
    "    \n",
    "    #c_6 = np.random.randint(60, 80, count)\n",
    "    c_6 = (np.random.rand(count) * 20 + 60)\n",
    "    c_6_max = np.max(c_6)\n",
    "    c_6_min = np.min(c_6)\n",
    "    data_max_min.append([c_6_max, c_6_min])\n",
    "    \n",
    "    #c_7 = np.random.randint(10, 15, count)\n",
    "    c_7 = (np.random.rand(count) * 5 + 10)\n",
    "    c_7_max = np.max(c_7)\n",
    "    c_7_min = np.min(c_7)\n",
    "    data_max_min.append([c_7_max, c_7_min])\n",
    "    \n",
    "    #c_8 = np.random.randint(60, 75, count)\n",
    "    c_8 = (np.random.rand(count) * 15 + 60)\n",
    "    c_8_max = np.max(c_8)\n",
    "    c_8_min = np.min(c_8)\n",
    "    data_max_min.append([c_8_max, c_8_min])\n",
    "    \n",
    "    #c_9 = np.random.randint(70, 80, count)\n",
    "    c_9 = (np.random.rand(count) * 10 + 70)\n",
    "    c_9_max = np.max(c_9)\n",
    "    c_9_min = np.min(c_9)\n",
    "    data_max_min.append([c_9_max, c_9_min])\n",
    "    \n",
    "    #c_10 = np.random.randint(4, 6, count)\n",
    "    c_10 = (np.random.rand(count) * 2 + 4)\n",
    "    c_10_max = np.max(c_10)\n",
    "    c_10_min = np.min(c_10)\n",
    "    data_max_min.append([c_10_max, c_10_min])\n",
    "    \n",
    "    #c_11 = np.random.randint(40, 60, count)\n",
    "    c_11 = (np.random.rand(count) * 20 + 40)\n",
    "    c_11_max = np.max(c_11)\n",
    "    c_11_min = np.min(c_11)\n",
    "    data_max_min.append([c_11_max, c_11_min])\n",
    "    \n",
    "    #c_12 = np.random.randint(20, 40, count)\n",
    "    c_12 = (np.random.rand(count) * 20 + 20)\n",
    "    c_12_max = np.max(c_12)\n",
    "    c_12_min = np.min(c_12)\n",
    "    data_max_min.append([c_12_max, c_12_min])\n",
    "    \n",
    "    #c_13 = np.random.randint(70, 80, count)\n",
    "    c_13 = (np.random.rand(count) * 10 + 70)\n",
    "    c_13_max = np.max(c_13)\n",
    "    c_13_min = np.min(c_13)\n",
    "    data_max_min.append([c_13_max, c_13_min])\n",
    "    \n",
    "    #c_14 = np.random.randint(40, 60, count)\n",
    "    c_14 = (np.random.rand(count) * 20 + 40)\n",
    "    c_14_max = np.max(c_14)\n",
    "    c_14_min = np.min(c_14)\n",
    "    data_max_min.append([c_14_max, c_14_min])\n",
    "    \n",
    "    #c_15 = np.random.randint(70, 80, count)\n",
    "    c_15 = (np.random.rand(count) * 10 + 70)\n",
    "    c_15_max = np.max(c_15)\n",
    "    c_15_min = np.min(c_15)\n",
    "    data_max_min.append([c_15_max, c_15_min])\n",
    "    \n",
    "    # c_16 = np.random.randint(60, 70, size=count, dtype=np.float32)\n",
    "    #c_16 = (np.random.rand(count) * 0.1 + 0.5)\n",
    "    c_16 = (np.random.rand(count) * 0.1 + 0.5)\n",
    "    c_16_max = np.max(c_16)\n",
    "    c_16_min = np.min(c_16)\n",
    "    data_max_min.append([c_16_max, c_16_min])\n",
    "    \n",
    "    #c_17 = np.random.randint(60, 80, count)\n",
    "    c_17 = (np.random.rand(count) * 20 + 60)\n",
    "    c_17_max = np.max(c_17)\n",
    "    c_17_min = np.min(c_17)\n",
    "    data_max_min.append([c_17_max, c_17_min])\n",
    "    \n",
    "    #c_18 = np.random.randint(40, 60, count)\n",
    "    c_18 = (np.random.rand(count) * 20 + 40)\n",
    "    c_18_max = np.max(c_18)\n",
    "    c_18_min = np.min(c_18)\n",
    "    data_max_min.append([c_18_max, c_18_min])\n",
    "    \n",
    "    #c_19 = np.random.randint(70, 80, count)\n",
    "    c_19 = (np.random.rand(count) * 10 + 70)\n",
    "    c_19_max = np.max(c_19)\n",
    "    c_19_min = np.min(c_19)\n",
    "    data_max_min.append([c_19_max, c_19_min])\n",
    "    \n",
    "    #c_20 = np.random.randint(70, 80, count)\n",
    "    c_20 = (np.random.rand(count) * 10 + 70)\n",
    "    c_20_max = np.max(c_20)\n",
    "    c_20_min = np.min(c_20)\n",
    "    data_max_min.append([c_20_max, c_20_min])\n",
    "    \n",
    "    #c_21 = np.random.randint(70, 85, count)\n",
    "    c_21 = (np.random.rand(count) * 15 + 70)\n",
    "    c_21_max = np.max(c_21)\n",
    "    c_21_min = np.min(c_21)\n",
    "    data_max_min.append([c_21_max, c_21_min])\n",
    "    \n",
    "    #c_22 = np.random.randint(70, 80, count)\n",
    "    c_22 = (np.random.rand(count) * 10 + 70)\n",
    "    c_22_max = np.max(c_22)\n",
    "    c_22_min = np.min(c_22)\n",
    "    data_max_min.append([c_22_max, c_22_min])\n",
    "    \n",
    "    #c_23 = np.random.randint(40, 60, count)\n",
    "    c_23 = (np.random.rand(count)  * 20 + 40)\n",
    "    c_23_max = np.max(c_23)\n",
    "    c_23_min = np.min(c_23)\n",
    "    data_max_min.append([c_23_max, c_23_min])\n",
    "    \n",
    "    #c_24 = np.random.randint(60, 80, count)\n",
    "    c_24 = (np.random.rand(count) * 20 + 60)\n",
    "    c_24_max = np.max(c_24)\n",
    "    c_24_min = np.min(c_24)\n",
    "    data_max_min.append([c_24_max, c_24_min])\n",
    "\n",
    "    for i in range(count):\n",
    "        data_row = []\n",
    "        data_row.append(startIndex + i)\n",
    "        data_row.append(float(c_1[i]))\n",
    "        data_row.append(float(c_2[i]))\n",
    "        data_row.append(float(c_3[i]))\n",
    "        data_row.append(float(c_4[i]))\n",
    "        data_row.append(float(c_5[i]))\n",
    "        data_row.append(float(c_6[i]))\n",
    "        data_row.append(float(c_7[i]))\n",
    "        data_row.append(float(c_8[i]))\n",
    "        data_row.append(float(c_9[i]))\n",
    "        data_row.append(float(c_10[i]))\n",
    "        data_row.append(float(c_11[i]))\n",
    "        data_row.append(float(c_12[i]))\n",
    "        data_row.append(float(c_13[i]))\n",
    "        data_row.append(float(c_14[i]))\n",
    "        data_row.append(float(c_15[i]))\n",
    "        data_row.append(float(c_16[i]))\n",
    "        data_row.append(float(c_17[i]))\n",
    "        data_row.append(float(c_18[i]))\n",
    "        data_row.append(float(c_19[i]))\n",
    "        data_row.append(float(c_20[i]))\n",
    "        data_row.append(float(c_21[i]))\n",
    "        data_row.append(float(c_22[i]))\n",
    "        data_row.append(float(c_23[i]))\n",
    "        data_row.append(float(c_24[i]))\n",
    "        data_row.append(3)\n",
    "        data_set.append(data_row)\n",
    "    return (data_set, data_max_min)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getLevelTwoData(count, startIndex):\n",
    "    data_set = []\n",
    "    data_max_min = []\n",
    "    c_1 = np.random.randint(60, 80, size=count)\n",
    "    c_1_max = np.max(c_1)\n",
    "    c_1_min = np.min(c_1)\n",
    "    data_max_min.append([c_1_max, c_1_min])\n",
    "    \n",
    "    # c_2 = (np.random.randint(90, 95, size=count) / 100)\n",
    "    c_2 = (np.random.rand(count) * 0.05 + 0.8)\n",
    "    c_2_max = np.max(c_2)\n",
    "    c_2_min = np.min(c_2)\n",
    "    data_max_min.append([c_2_max, c_2_min])\n",
    "    \n",
    "    c_3 = np.random.randint(20, 40, count)\n",
    "    c_3_max = np.max(c_3)\n",
    "    c_3_min = np.min(c_3)\n",
    "    data_max_min.append([c_3_max, c_3_min])\n",
    "    \n",
    "    c_4 = np.random.randint(2000, 3000, count)\n",
    "    c_4_max = np.max(c_4)\n",
    "    c_4_min = np.min(c_4)\n",
    "    data_max_min.append([c_4_max, c_4_min])\n",
    "    \n",
    "    c_5 = np.random.randint(40, 60, count)\n",
    "    c_5_max = np.max(c_5)\n",
    "    c_5_min = np.min(c_5)\n",
    "    data_max_min.append([c_5_max, c_5_min])\n",
    "    \n",
    "    c_6 = np.random.randint(40, 60, count)\n",
    "    c_6_max = np.max(c_6)\n",
    "    c_6_min = np.min(c_6)\n",
    "    data_max_min.append([c_6_max, c_6_min])\n",
    "    \n",
    "    c_7 = np.random.randint(5, 10, count)\n",
    "    c_7_max = np.max(c_7)\n",
    "    c_7_min = np.min(c_7)\n",
    "    data_max_min.append([c_7_max, c_7_min])\n",
    "    \n",
    "    c_8 = np.random.randint(30, 60, count)\n",
    "    c_8_max = np.max(c_8)\n",
    "    c_8_min = np.min(c_8)\n",
    "    data_max_min.append([c_8_max, c_8_min])\n",
    "    \n",
    "    c_9 = np.random.randint(50, 70, count)\n",
    "    c_9_max = np.max(c_9)\n",
    "    c_9_min = np.min(c_9)\n",
    "    data_max_min.append([c_9_max, c_9_min])\n",
    "    \n",
    "    c_10 = np.random.randint(6, 10, count)\n",
    "    c_10_max = np.max(c_10)\n",
    "    c_10_min = np.min(c_10)\n",
    "    data_max_min.append([c_10_max, c_10_min])\n",
    "    \n",
    "    c_11 = np.random.randint(20, 40, count)\n",
    "    c_11_max = np.max(c_11)\n",
    "    c_11_min = np.min(c_11)\n",
    "    data_max_min.append([c_11_max, c_11_min])\n",
    "    \n",
    "    c_12 = np.random.randint(40, 60, count)\n",
    "    c_12_max = np.max(c_12)\n",
    "    c_12_min = np.min(c_12)\n",
    "    data_max_min.append([c_12_max, c_12_min])\n",
    "    \n",
    "    c_13 = np.random.randint(50, 70, count)\n",
    "    c_13_max = np.max(c_13)\n",
    "    c_13_min = np.min(c_13)\n",
    "    data_max_min.append([c_13_max, c_13_min])\n",
    "    \n",
    "    c_14 = np.random.randint(60, 80, count)\n",
    "    c_14_max = np.max(c_14)\n",
    "    c_14_min = np.min(c_14)\n",
    "    data_max_min.append([c_14_max, c_14_min])\n",
    "    \n",
    "    c_15 = np.random.randint(50, 70, count)\n",
    "    c_15_max = np.max(c_15)\n",
    "    c_15_min = np.min(c_15)\n",
    "    data_max_min.append([c_15_max, c_15_min])\n",
    "    \n",
    "    # c_16 = np.random.randint(60, 70, size=count, dtype=np.float32)\n",
    "    c_16 = (np.random.rand(count) * 0.1 + 0.4)\n",
    "    c_16_max = np.max(c_16)\n",
    "    c_16_min = np.min(c_16)\n",
    "    data_max_min.append([c_16_max, c_16_min])\n",
    "    \n",
    "    c_17 = np.random.randint(40, 60, count)\n",
    "    c_17_max = np.max(c_17)\n",
    "    c_17_min = np.min(c_17)\n",
    "    data_max_min.append([c_17_max, c_17_min])\n",
    "    \n",
    "    c_18 = np.random.randint(20, 40, count)\n",
    "    c_18_max = np.max(c_18)\n",
    "    c_18_min = np.min(c_18)\n",
    "    data_max_min.append([c_18_max, c_18_min])\n",
    "    \n",
    "    c_19 = np.random.randint(40, 70, count)\n",
    "    c_19_max = np.max(c_19)\n",
    "    c_19_min = np.min(c_19)\n",
    "    data_max_min.append([c_19_max, c_19_min])\n",
    "    \n",
    "    c_20 = np.random.randint(40, 70, count)\n",
    "    c_20_max = np.max(c_20)\n",
    "    c_20_min = np.min(c_20)\n",
    "    data_max_min.append([c_20_max, c_20_min])\n",
    "    \n",
    "    c_21 = np.random.randint(40, 70, count)\n",
    "    c_21_max = np.max(c_21)\n",
    "    c_21_min = np.min(c_21)\n",
    "    data_max_min.append([c_21_max, c_21_min])\n",
    "    \n",
    "    c_22 = np.random.randint(50, 70, count)\n",
    "    c_22_max = np.max(c_22)\n",
    "    c_22_min = np.min(c_22)\n",
    "    data_max_min.append([c_22_max, c_22_min])\n",
    "    \n",
    "    c_23 = np.random.randint(20, 40, count)\n",
    "    c_23_max = np.max(c_23)\n",
    "    c_23_min = np.min(c_23)\n",
    "    data_max_min.append([c_23_max, c_23_min])\n",
    "    \n",
    "    c_24 = np.random.randint(30, 60, count)\n",
    "    c_24_max = np.max(c_24)\n",
    "    c_24_min = np.min(c_24)\n",
    "    data_max_min.append([c_24_max, c_24_min])\n",
    "\n",
    "    for i in range(count):\n",
    "        data_row = []\n",
    "        data_row.append(startIndex + i)\n",
    "        data_row.append(float(c_1[i]))\n",
    "        data_row.append(float(c_2[i]))\n",
    "        data_row.append(float(c_3[i]))\n",
    "        data_row.append(float(c_4[i]))\n",
    "        data_row.append(float(c_5[i]))\n",
    "        data_row.append(float(c_6[i]))\n",
    "        data_row.append(float(c_7[i]))\n",
    "        data_row.append(float(c_8[i]))\n",
    "        data_row.append(float(c_9[i]))\n",
    "        data_row.append(float(c_10[i]))\n",
    "        data_row.append(float(c_11[i]))\n",
    "        data_row.append(float(c_12[i]))\n",
    "        data_row.append(float(c_13[i]))\n",
    "        data_row.append(float(c_14[i]))\n",
    "        data_row.append(float(c_15[i]))\n",
    "        data_row.append(float(c_16[i]))\n",
    "        data_row.append(float(c_17[i]))\n",
    "        data_row.append(float(c_18[i]))\n",
    "        data_row.append(float(c_19[i]))\n",
    "        data_row.append(float(c_20[i]))\n",
    "        data_row.append(float(c_21[i]))\n",
    "        data_row.append(float(c_22[i]))\n",
    "        data_row.append(float(c_23[i]))\n",
    "        data_row.append(float(c_24[i]))\n",
    "        data_row.append(2.0)\n",
    "        data_set.append(data_row)\n",
    "    return (data_set, data_max_min)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getLevelTwoData_v2(count, startIndex):\n",
    "    data_set = []\n",
    "    data_max_min = []\n",
    "    c_1 = (np.random.rand(count) * 20 + 60)\n",
    "    c_1_max = np.max(c_1)\n",
    "    c_1_min = np.min(c_1)\n",
    "    data_max_min.append([c_1_max, c_1_min])\n",
    "    \n",
    "    # c_2 = (np.random.randint(90, 95, size=count) / 100)\n",
    "    c_2 = (np.random.rand(count) * 0.05 + 0.8)\n",
    "    c_2_max = np.max(c_2)\n",
    "    c_2_min = np.min(c_2)\n",
    "    data_max_min.append([c_2_max, c_2_min])\n",
    "    \n",
    "    c_3 = (np.random.rand(count) * 20 + 20)\n",
    "    c_3_max = np.max(c_3)\n",
    "    c_3_min = np.min(c_3)\n",
    "    data_max_min.append([c_3_max, c_3_min])\n",
    "    \n",
    "    c_4 = (np.random.rand(count) * 1000 + 2000)\n",
    "    c_4_max = np.max(c_4)\n",
    "    c_4_min = np.min(c_4)\n",
    "    data_max_min.append([c_4_max, c_4_min])\n",
    "    \n",
    "    c_5 = (np.random.rand(count) * 20 + 40)\n",
    "    c_5_max = np.max(c_5)\n",
    "    c_5_min = np.min(c_5)\n",
    "    data_max_min.append([c_5_max, c_5_min])\n",
    "    \n",
    "    c_6 = (np.random.rand(count) * 20 + 40)\n",
    "    c_6_max = np.max(c_6)\n",
    "    c_6_min = np.min(c_6)\n",
    "    data_max_min.append([c_6_max, c_6_min])\n",
    "    \n",
    "    c_7 = (np.random.rand(count) * 5 + 5)\n",
    "    c_7_max = np.max(c_7)\n",
    "    c_7_min = np.min(c_7)\n",
    "    data_max_min.append([c_7_max, c_7_min])\n",
    "    \n",
    "    c_8 = (np.random.rand(count) * 30 + 30)\n",
    "    c_8_max = np.max(c_8)\n",
    "    c_8_min = np.min(c_8)\n",
    "    data_max_min.append([c_8_max, c_8_min])\n",
    "    \n",
    "    c_9 = (np.random.rand(count) * 20 + 50)\n",
    "    c_9_max = np.max(c_9)\n",
    "    c_9_min = np.min(c_9)\n",
    "    data_max_min.append([c_9_max, c_9_min])\n",
    "    \n",
    "    c_10 = (np.random.rand(count) * 4 + 6)\n",
    "    c_10_max = np.max(c_10)\n",
    "    c_10_min = np.min(c_10)\n",
    "    data_max_min.append([c_10_max, c_10_min])\n",
    "    \n",
    "    c_11 = (np.random.rand(count) * 20 + 20)\n",
    "    c_11_max = np.max(c_11)\n",
    "    c_11_min = np.min(c_11)\n",
    "    data_max_min.append([c_11_max, c_11_min])\n",
    "    \n",
    "    c_12 = (np.random.rand(count) * 20 + 40)\n",
    "    c_12_max = np.max(c_12)\n",
    "    c_12_min = np.min(c_12)\n",
    "    data_max_min.append([c_12_max, c_12_min])\n",
    "    \n",
    "    c_13 = (np.random.rand(count) * 20 + 50)\n",
    "    c_13_max = np.max(c_13)\n",
    "    c_13_min = np.min(c_13)\n",
    "    data_max_min.append([c_13_max, c_13_min])\n",
    "    \n",
    "    c_14 = (np.random.rand(count) * 20 + 60)\n",
    "    c_14_max = np.max(c_14)\n",
    "    c_14_min = np.min(c_14)\n",
    "    data_max_min.append([c_14_max, c_14_min])\n",
    "    \n",
    "    c_15 = (np.random.rand(count) * 20 + 50)\n",
    "    c_15_max = np.max(c_15)\n",
    "    c_15_min = np.min(c_15)\n",
    "    data_max_min.append([c_15_max, c_15_min])\n",
    "    \n",
    "    # c_16 = np.random.randint(60, 70, size=count, dtype=np.float32)\n",
    "    c_16 = (np.random.rand(count) * 0.1 + 0.4)\n",
    "    c_16_max = np.max(c_16)\n",
    "    c_16_min = np.min(c_16)\n",
    "    data_max_min.append([c_16_max, c_16_min])\n",
    "    \n",
    "    c_17 = (np.random.rand(count) * 20 + 40)\n",
    "    c_17_max = np.max(c_17)\n",
    "    c_17_min = np.min(c_17)\n",
    "    data_max_min.append([c_17_max, c_17_min])\n",
    "    \n",
    "    c_18 = (np.random.rand(count) * 20 + 20)\n",
    "    c_18_max = np.max(c_18)\n",
    "    c_18_min = np.min(c_18)\n",
    "    data_max_min.append([c_18_max, c_18_min])\n",
    "    \n",
    "    c_19 = (np.random.rand(count) * 30 + 40)\n",
    "    c_19_max = np.max(c_19)\n",
    "    c_19_min = np.min(c_19)\n",
    "    data_max_min.append([c_19_max, c_19_min])\n",
    "    \n",
    "    c_20 = (np.random.rand(count) * 30 + 40)\n",
    "    c_20_max = np.max(c_20)\n",
    "    c_20_min = np.min(c_20)\n",
    "    data_max_min.append([c_20_max, c_20_min])\n",
    "    \n",
    "    c_21 = (np.random.rand(count) * 30 + 40)\n",
    "    c_21_max = np.max(c_21)\n",
    "    c_21_min = np.min(c_21)\n",
    "    data_max_min.append([c_21_max, c_21_min])\n",
    "    \n",
    "    c_22 = (np.random.rand(count) * 20 + 50)\n",
    "    c_22_max = np.max(c_22)\n",
    "    c_22_min = np.min(c_22)\n",
    "    data_max_min.append([c_22_max, c_22_min])\n",
    "    \n",
    "    c_23 = (np.random.rand(count) * 20 + 20)\n",
    "    c_23_max = np.max(c_23)\n",
    "    c_23_min = np.min(c_23)\n",
    "    data_max_min.append([c_23_max, c_23_min])\n",
    "    \n",
    "    c_24 = (np.random.rand(count) * 30 + 30)\n",
    "    c_24_max = np.max(c_24)\n",
    "    c_24_min = np.min(c_24)\n",
    "    data_max_min.append([c_24_max, c_24_min])\n",
    "\n",
    "    for i in range(count):\n",
    "        data_row = []\n",
    "        data_row.append(startIndex + i)\n",
    "        data_row.append(float(c_1[i]))\n",
    "        data_row.append(float(c_2[i]))\n",
    "        data_row.append(float(c_3[i]))\n",
    "        data_row.append(float(c_4[i]))\n",
    "        data_row.append(float(c_5[i]))\n",
    "        data_row.append(float(c_6[i]))\n",
    "        data_row.append(float(c_7[i]))\n",
    "        data_row.append(float(c_8[i]))\n",
    "        data_row.append(float(c_9[i]))\n",
    "        data_row.append(float(c_10[i]))\n",
    "        data_row.append(float(c_11[i]))\n",
    "        data_row.append(float(c_12[i]))\n",
    "        data_row.append(float(c_13[i]))\n",
    "        data_row.append(float(c_14[i]))\n",
    "        data_row.append(float(c_15[i]))\n",
    "        data_row.append(float(c_16[i]))\n",
    "        data_row.append(float(c_17[i]))\n",
    "        data_row.append(float(c_18[i]))\n",
    "        data_row.append(float(c_19[i]))\n",
    "        data_row.append(float(c_20[i]))\n",
    "        data_row.append(float(c_21[i]))\n",
    "        data_row.append(float(c_22[i]))\n",
    "        data_row.append(float(c_23[i]))\n",
    "        data_row.append(float(c_24[i]))\n",
    "        data_row.append(2)\n",
    "        data_set.append(data_row)\n",
    "    return (data_set, data_max_min)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getLevelOneData(count, startIndex):\n",
    "    data_set = []\n",
    "    data_max_min = []\n",
    "    c_1 = np.random.randint(low=80, size=count)\n",
    "    c_1_max = np.max(c_1)\n",
    "    c_1_min = np.min(c_1)\n",
    "    data_max_min.append([c_1_max, c_1_min])\n",
    "    \n",
    "    # c_2 = (np.random.randint(90, 95, size=count) / 100)\n",
    "    c_2 = (np.random.rand(count) * 0.8)\n",
    "    c_2_max = np.max(c_2)\n",
    "    c_2_min = np.min(c_2)\n",
    "    data_max_min.append([c_2_max, c_2_min])\n",
    "    \n",
    "    c_3 = np.random.randint(0, 20, count)\n",
    "    c_3_max = np.max(c_3)\n",
    "    c_3_min = np.min(c_3)\n",
    "    data_max_min.append([c_3_max, c_3_min])\n",
    "    \n",
    "    c_4 = np.random.randint(0, 2000, count)\n",
    "    c_4_max = np.max(c_4)\n",
    "    c_4_min = np.min(c_4)\n",
    "    data_max_min.append([c_4_max, c_4_min])\n",
    "    \n",
    "    c_5 = np.random.randint(0, 40, count)\n",
    "    c_5_max = np.max(c_5)\n",
    "    c_5_min = np.min(c_5)\n",
    "    data_max_min.append([c_5_max, c_5_min])\n",
    "    \n",
    "    c_6 = np.random.randint(0, 40, count)\n",
    "    c_6_max = np.max(c_6)\n",
    "    c_6_min = np.min(c_6)\n",
    "    data_max_min.append([c_6_max, c_6_min])\n",
    "    \n",
    "    c_7 = np.random.randint(0, 5, count)\n",
    "    c_7_max = np.max(c_7)\n",
    "    c_7_min = np.min(c_7)\n",
    "    data_max_min.append([c_7_max, c_7_min])\n",
    "    \n",
    "    c_8 = np.random.randint(0, 30, count)\n",
    "    c_8_max = np.max(c_8)\n",
    "    c_8_min = np.min(c_8)\n",
    "    data_max_min.append([c_8_max, c_8_min])\n",
    "    \n",
    "    c_9 = np.random.randint(0, 50, count)\n",
    "    c_9_max = np.max(c_9)\n",
    "    c_9_min = np.min(c_9)\n",
    "    data_max_min.append([c_9_max, c_9_min])\n",
    "    \n",
    "    c_10 = np.random.randint(low=10, size=count)\n",
    "    c_10_max = np.max(c_10)\n",
    "    c_10_min = np.min(c_10)\n",
    "    data_max_min.append([c_10_max, c_10_min])\n",
    "    \n",
    "    c_11 = np.random.randint(0, 20, count)\n",
    "    c_11_max = np.max(c_11)\n",
    "    c_11_min = np.min(c_11)\n",
    "    data_max_min.append([c_11_max, c_11_min])\n",
    "    \n",
    "    c_12 = np.random.randint(low=60, size=count)\n",
    "    c_12_max = np.max(c_12)\n",
    "    c_12_min = np.min(c_12)\n",
    "    data_max_min.append([c_12_max, c_12_min])\n",
    "    \n",
    "    c_13 = np.random.randint(0, 50, count)\n",
    "    c_13_max = np.max(c_13)\n",
    "    c_13_min = np.min(c_13)\n",
    "    data_max_min.append([c_13_max, c_13_min])\n",
    "    \n",
    "    c_14 = np.random.randint(low=80, size=count)\n",
    "    c_14_max = np.max(c_14)\n",
    "    c_14_min = np.min(c_14)\n",
    "    data_max_min.append([c_14_max, c_14_min])\n",
    "    \n",
    "    c_15 = np.random.randint(0, 50, count)\n",
    "    c_15_max = np.max(c_15)\n",
    "    c_15_min = np.min(c_15)\n",
    "    data_max_min.append([c_15_max, c_15_min])\n",
    "    \n",
    "    # c_16 = np.random.randint(60, 70, size=count, dtype=np.float32)\n",
    "    c_16 = (np.random.rand(count) * 0.4)\n",
    "    c_16_max = np.max(c_16)\n",
    "    c_16_min = np.min(c_16)\n",
    "    data_max_min.append([c_16_max, c_16_min])\n",
    "    \n",
    "    c_17 = np.random.randint(0, 40, count)\n",
    "    c_17_max = np.max(c_17)\n",
    "    c_17_min = np.min(c_17)\n",
    "    data_max_min.append([c_17_max, c_17_min])\n",
    "    \n",
    "    c_18 = np.random.randint(0, 20, count)\n",
    "    c_18_max = np.max(c_18)\n",
    "    c_18_min = np.min(c_18)\n",
    "    data_max_min.append([c_18_max, c_18_min])\n",
    "    \n",
    "    c_19 = np.random.randint(0, 40, count)\n",
    "    c_19_max = np.max(c_19)\n",
    "    c_19_min = np.min(c_19)\n",
    "    data_max_min.append([c_19_max, c_19_min])\n",
    "    \n",
    "    c_20 = np.random.randint(0, 40, count)\n",
    "    c_20_max = np.max(c_20)\n",
    "    c_20_min = np.min(c_20)\n",
    "    data_max_min.append([c_20_max, c_20_min])\n",
    "    \n",
    "    c_21 = np.random.randint(0, 40, count)\n",
    "    c_21_max = np.max(c_21)\n",
    "    c_21_min = np.min(c_21)\n",
    "    data_max_min.append([c_21_max, c_21_min])\n",
    "    \n",
    "    c_22 = np.random.randint(0, 50, count)\n",
    "    c_22_max = np.max(c_22)\n",
    "    c_22_min = np.min(c_22)\n",
    "    data_max_min.append([c_22_max, c_22_min])\n",
    "    \n",
    "    c_23 = np.random.randint(0, 20, count)\n",
    "    c_23_max = np.max(c_23)\n",
    "    c_23_min = np.min(c_23)\n",
    "    data_max_min.append([c_23_max, c_23_min])\n",
    "    \n",
    "    c_24 = np.random.randint(0, 30, count)\n",
    "    c_24_max = np.max(c_24)\n",
    "    c_24_min = np.min(c_24)\n",
    "    data_max_min.append([c_24_max, c_24_min])\n",
    "\n",
    "    for i in range(count):\n",
    "        data_row = []\n",
    "        data_row.append(startIndex + i)\n",
    "        data_row.append(float(c_1[i]))\n",
    "        data_row.append(float(c_2[i]))\n",
    "        data_row.append(float(c_3[i]))\n",
    "        data_row.append(float(c_4[i]))\n",
    "        data_row.append(float(c_5[i]))\n",
    "        data_row.append(float(c_6[i]))\n",
    "        data_row.append(float(c_7[i]))\n",
    "        data_row.append(float(c_8[i]))\n",
    "        data_row.append(float(c_9[i]))\n",
    "        data_row.append(float(c_10[i]))\n",
    "        data_row.append(float(c_11[i]))\n",
    "        data_row.append(float(c_12[i]))\n",
    "        data_row.append(float(c_13[i]))\n",
    "        data_row.append(float(c_14[i]))\n",
    "        data_row.append(float(c_15[i]))\n",
    "        data_row.append(float(c_16[i]))\n",
    "        data_row.append(float(c_17[i]))\n",
    "        data_row.append(float(c_18[i]))\n",
    "        data_row.append(float(c_19[i]))\n",
    "        data_row.append(float(c_20[i]))\n",
    "        data_row.append(float(c_21[i]))\n",
    "        data_row.append(float(c_22[i]))\n",
    "        data_row.append(float(c_23[i]))\n",
    "        data_row.append(float(c_24[i]))\n",
    "        data_row.append(1.0)\n",
    "        data_set.append(data_row)\n",
    "    return (data_set, data_max_min)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getLevelOneData_v2(count, startIndex):\n",
    "    data_set = []\n",
    "    data_max_min = []\n",
    "    c_1 = (np.random.rand(count) * 720 + 80)\n",
    "    c_1_max = np.max(c_1)\n",
    "    c_1_min = np.min(c_1)\n",
    "    data_max_min.append([c_1_max, c_1_min])\n",
    "    \n",
    "    # c_2 = (np.random.randint(90, 95, size=count) / 100)\n",
    "    c_2 = (np.random.rand(count) * 0.72 + 0.08)\n",
    "    c_2_max = np.max(c_2)\n",
    "    c_2_min = np.min(c_2)\n",
    "    data_max_min.append([c_2_max, c_2_min])\n",
    "    \n",
    "    c_3 = (np.random.rand(count) * 18 + 2)\n",
    "    c_3_max = np.max(c_3)\n",
    "    c_3_min = np.min(c_3)\n",
    "    data_max_min.append([c_3_max, c_3_min])\n",
    "    \n",
    "    c_4 = (np.random.rand(count) * 1800 + 200)\n",
    "    c_4_max = np.max(c_4)\n",
    "    c_4_min = np.min(c_4)\n",
    "    data_max_min.append([c_4_max, c_4_min])\n",
    "    \n",
    "    c_5 = (np.random.rand(count) * 36 + 4)\n",
    "    c_5_max = np.max(c_5)\n",
    "    c_5_min = np.min(c_5)\n",
    "    data_max_min.append([c_5_max, c_5_min])\n",
    "    \n",
    "    c_6 = (np.random.rand(count) * 36 + 4)\n",
    "    c_6_max = np.max(c_6)\n",
    "    c_6_min = np.min(c_6)\n",
    "    data_max_min.append([c_6_max, c_6_min])\n",
    "    \n",
    "    c_7 = (np.random.rand(count) * 4.5 + 0.5)\n",
    "    c_7_max = np.max(c_7)\n",
    "    c_7_min = np.min(c_7)\n",
    "    data_max_min.append([c_7_max, c_7_min])\n",
    "    \n",
    "    c_8 = (np.random.rand(count) * 27 + 3)\n",
    "    c_8_max = np.max(c_8)\n",
    "    c_8_min = np.min(c_8)\n",
    "    data_max_min.append([c_8_max, c_8_min])\n",
    "    \n",
    "    c_9 = (np.random.rand(count) * 45 + 5)\n",
    "    c_9_max = np.max(c_9)\n",
    "    c_9_min = np.min(c_9)\n",
    "    data_max_min.append([c_9_max, c_9_min])\n",
    "    \n",
    "    c_10 = (np.random.rand(count) * 90 + 10)\n",
    "    c_10_max = np.max(c_10)\n",
    "    c_10_min = np.min(c_10)\n",
    "    data_max_min.append([c_10_max, c_10_min])\n",
    "    \n",
    "    c_11 = (np.random.rand(count) * 18 + 2)\n",
    "    c_11_max = np.max(c_11)\n",
    "    c_11_min = np.min(c_11)\n",
    "    data_max_min.append([c_11_max, c_11_min])\n",
    "    \n",
    "    c_12 = (np.random.rand(count) * 540 + 60)\n",
    "    c_12_max = np.max(c_12)\n",
    "    c_12_min = np.min(c_12)\n",
    "    data_max_min.append([c_12_max, c_12_min])\n",
    "    \n",
    "    c_13 = (np.random.rand(count) * 45 + 5)\n",
    "    c_13_max = np.max(c_13)\n",
    "    c_13_min = np.min(c_13)\n",
    "    data_max_min.append([c_13_max, c_13_min])\n",
    "    \n",
    "    c_14 = (np.random.rand(count) * 720 + 80)\n",
    "    c_14_max = np.max(c_14)\n",
    "    c_14_min = np.min(c_14)\n",
    "    data_max_min.append([c_14_max, c_14_min])\n",
    "    \n",
    "    c_15 = (np.random.rand(count) * 45 + 5)\n",
    "    c_15_max = np.max(c_15)\n",
    "    c_15_min = np.min(c_15)\n",
    "    data_max_min.append([c_15_max, c_15_min])\n",
    "    \n",
    "    # c_16 = np.random.randint(60, 70, size=count, dtype=np.float32)\n",
    "    c_16 = (np.random.rand(count) * 0.36 + 0.04)\n",
    "    c_16_max = np.max(c_16)\n",
    "    c_16_min = np.min(c_16)\n",
    "    data_max_min.append([c_16_max, c_16_min])\n",
    "    \n",
    "    c_17 = (np.random.rand(count) * 36 + 4)\n",
    "    c_17_max = np.max(c_17)\n",
    "    c_17_min = np.min(c_17)\n",
    "    data_max_min.append([c_17_max, c_17_min])\n",
    "    \n",
    "    c_18 = (np.random.rand(count) * 18 + 2)\n",
    "    c_18_max = np.max(c_18)\n",
    "    c_18_min = np.min(c_18)\n",
    "    data_max_min.append([c_18_max, c_18_min])\n",
    "    \n",
    "    c_19 = (np.random.rand(count) * 36 + 4)\n",
    "    c_19_max = np.max(c_19)\n",
    "    c_19_min = np.min(c_19)\n",
    "    data_max_min.append([c_19_max, c_19_min])\n",
    "    \n",
    "    c_20 = (np.random.rand(count) * 36 + 4)\n",
    "    c_20_max = np.max(c_20)\n",
    "    c_20_min = np.min(c_20)\n",
    "    data_max_min.append([c_20_max, c_20_min])\n",
    "    \n",
    "    c_21 = (np.random.rand(count) * 36 + 4)\n",
    "    c_21_max = np.max(c_21)\n",
    "    c_21_min = np.min(c_21)\n",
    "    data_max_min.append([c_21_max, c_21_min])\n",
    "    \n",
    "    c_22 = (np.random.rand(count) * 45 + 5)\n",
    "    c_22_max = np.max(c_22)\n",
    "    c_22_min = np.min(c_22)\n",
    "    data_max_min.append([c_22_max, c_22_min])\n",
    "    \n",
    "    c_23 = (np.random.rand(count) * 18 + 2)\n",
    "    c_23_max = np.max(c_23)\n",
    "    c_23_min = np.min(c_23)\n",
    "    data_max_min.append([c_23_max, c_23_min])\n",
    "    \n",
    "    c_24 = (np.random.rand(count) * 27 + 3)\n",
    "    c_24_max = np.max(c_24)\n",
    "    c_24_min = np.min(c_24)\n",
    "    data_max_min.append([c_24_max, c_24_min])\n",
    "\n",
    "    for i in range(count):\n",
    "        data_row = []\n",
    "        data_row.append(startIndex + i)\n",
    "        data_row.append(float(c_1[i]))\n",
    "        data_row.append(float(c_2[i]))\n",
    "        data_row.append(float(c_3[i]))\n",
    "        data_row.append(float(c_4[i]))\n",
    "        data_row.append(float(c_5[i]))\n",
    "        data_row.append(float(c_6[i]))\n",
    "        data_row.append(float(c_7[i]))\n",
    "        data_row.append(float(c_8[i]))\n",
    "        data_row.append(float(c_9[i]))\n",
    "        data_row.append(float(c_10[i]))\n",
    "        data_row.append(float(c_11[i]))\n",
    "        data_row.append(float(c_12[i]))\n",
    "        data_row.append(float(c_13[i]))\n",
    "        data_row.append(float(c_14[i]))\n",
    "        data_row.append(float(c_15[i]))\n",
    "        data_row.append(float(c_16[i]))\n",
    "        data_row.append(float(c_17[i]))\n",
    "        data_row.append(float(c_18[i]))\n",
    "        data_row.append(float(c_19[i]))\n",
    "        data_row.append(float(c_20[i]))\n",
    "        data_row.append(float(c_21[i]))\n",
    "        data_row.append(float(c_22[i]))\n",
    "        data_row.append(float(c_23[i]))\n",
    "        data_row.append(float(c_24[i]))\n",
    "        data_row.append(1)\n",
    "        data_set.append(data_row)\n",
    "    return (data_set, data_max_min)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# data_five, data_max_min_five = getLevelFiveData(100, 1)\n",
    "data_five, data_max_min_five = getLevelFiveData_v2(100, 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "#for d in data_five:\n",
    "#    print(d)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "#data_four, data_max_min_four = getLevelFourData(100, 101)\n",
    "data_four, data_max_min_four = getLevelFourData_v2(100, 101)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "#data_three, data_max_min_three = getLevelThreeData(100, 201)\n",
    "data_three, data_max_min_three = getLevelThreeData_v2(100, 201)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "#data_two, data_max_min_two = getLevelTwoData(100, 301)\n",
    "data_two, data_max_min_two = getLevelTwoData_v2(100, 301)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "#data_one, data_max_min_one = getLevelOneData(100, 401)\n",
    "data_one, data_max_min_one = getLevelOneData_v2(100, 401)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "c_1_max = 800.0\n",
    "c_1_min = 2.0\n",
    "\n",
    "c_2_max = 9.5\n",
    "c_2_min = 0.08\n",
    "\n",
    "c_3_max = 800.0\n",
    "c_3_min = 0.2\n",
    "\n",
    "c_4_max = 50000.0\n",
    "c_4_min = 200.0\n",
    "\n",
    "c_5_max = 950.0\n",
    "c_5_min = 4.0\n",
    "\n",
    "c_6_max = 950.0\n",
    "c_6_min = 4.0\n",
    "\n",
    "c_7_max = 200.0\n",
    "c_7_min = 0.5\n",
    "\n",
    "c_8_max = 900.0\n",
    "c_8_min = 3.0\n",
    "\n",
    "c_9_max = 900.0\n",
    "c_9_min = 5.0\n",
    "\n",
    "c_10_max = 100.0\n",
    "c_10_min = 0.2\n",
    "\n",
    "c_11_max = 800.0\n",
    "c_11_min = 2.0\n",
    "\n",
    "c_12_max = 600.0\n",
    "c_12_min = 1.0\n",
    "\n",
    "c_13_max = 900.0\n",
    "c_13_min = 5.0\n",
    "\n",
    "c_14_max = 800.0\n",
    "c_14_min = 2.0\n",
    "\n",
    "c_15_max = 900.0\n",
    "c_15_min = 5.0\n",
    "\n",
    "c_16_max = 7.0\n",
    "c_16_min = 0.04\n",
    "\n",
    "c_17_max = 950.0\n",
    "c_17_min = 4.0\n",
    "\n",
    "c_18_max = 800.0\n",
    "c_18_min = 2.0\n",
    "\n",
    "c_19_max = 900.0\n",
    "c_19_min = 4.0\n",
    "\n",
    "c_20_max = 900.0\n",
    "c_20_min = 4.0\n",
    "\n",
    "c_21_max = 950.0\n",
    "c_21_min = 4.0\n",
    "\n",
    "c_22_max = 900.0\n",
    "c_22_min = 5.0\n",
    "\n",
    "c_23_max = 800.0\n",
    "c_23_min = 2.0\n",
    "\n",
    "c_24_max = 900.0\n",
    "c_24_min = 3.0\n",
    "\n",
    "data_all = []"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 归一化处理数据，length=26\n",
    "def preHandleData_L26(item):\n",
    "    data_row = [] \n",
    "    data_row.append(item[0])\n",
    "    data_row.append((c_1_max - item[1])/(c_1_max - c_1_min)) # 负向\n",
    "    data_row.append((item[2] - c_2_min)/(c_2_max - c_2_min)) # 正向\n",
    "    data_row.append((item[3] - c_3_min)/(c_3_max - c_3_min))\n",
    "    data_row.append((item[4] - c_4_min)/(c_4_max - c_4_min))\n",
    "    data_row.append((item[5] - c_5_min)/(c_5_max - c_5_min))\n",
    "    data_row.append((item[6] - c_6_min)/(c_6_max - c_6_min))\n",
    "    data_row.append((item[7] - c_7_min)/(c_7_max - c_7_min))\n",
    "    data_row.append((item[8] - c_8_min)/(c_8_max - c_8_min))\n",
    "    data_row.append((item[9] - c_9_min)/(c_9_max - c_9_min))\n",
    "    data_row.append((c_10_max - item[10])/(c_10_max - c_10_min))\n",
    "    data_row.append((item[11] - c_11_min)/(c_11_max - c_11_min))\n",
    "    data_row.append((c_12_max - item[12])/(c_12_max - c_12_min))\n",
    "    data_row.append((item[13] - c_13_min)/(c_13_max - c_13_min))\n",
    "    data_row.append((c_14_max - item[14])/(c_14_max - c_14_min))\n",
    "    data_row.append((item[15] - c_15_min)/(c_15_max - c_15_min))\n",
    "    data_row.append((item[16] - c_16_min)/(c_16_max - c_16_min))\n",
    "    data_row.append((item[17] - c_17_min)/(c_17_max - c_17_min))\n",
    "    data_row.append((item[18] - c_18_min)/(c_18_max - c_18_min))\n",
    "    data_row.append((item[19] - c_19_min)/(c_19_max - c_19_min))\n",
    "    data_row.append((item[20] - c_20_min)/(c_20_max - c_20_min))\n",
    "    data_row.append((item[21] - c_21_min)/(c_21_max - c_21_min))\n",
    "    data_row.append((item[22] - c_22_min)/(c_22_max - c_22_min))\n",
    "    data_row.append((item[23] - c_23_min)/(c_23_max - c_23_min))\n",
    "    data_row.append((item[24] - c_24_min)/(c_24_max - c_24_min))\n",
    "    data_row.append(item[25])\n",
    "    return data_row\n",
    "\n",
    "def preHandleData_L26_v2(item):\n",
    "    data_row = [] \n",
    "    data_row.append(item[0])\n",
    "    data_row.append(((1/item[1]) * 100)/(c_1_max - c_1_min)) # 负向\n",
    "    data_row.append((item[2] - c_2_min)/(c_2_max - c_2_min)) # 正向\n",
    "    data_row.append((item[3] - c_3_min)/(c_3_max - c_3_min))\n",
    "    data_row.append((item[4] - c_4_min)/(c_4_max - c_4_min))\n",
    "    data_row.append((item[5] - c_5_min)/(c_5_max - c_5_min))\n",
    "    data_row.append((item[6] - c_6_min)/(c_6_max - c_6_min))\n",
    "    data_row.append((item[7] - c_7_min)/(c_7_max - c_7_min))\n",
    "    data_row.append((item[8] - c_8_min)/(c_8_max - c_8_min))\n",
    "    data_row.append((item[9] - c_9_min)/(c_9_max - c_9_min))\n",
    "    data_row.append(((1/item[10]) * 100)/(c_10_max - c_10_min))\n",
    "    data_row.append((item[11] - c_11_min)/(c_11_max - c_11_min))\n",
    "    data_row.append(((1/item[12]) * 100)/(c_12_max - c_12_min))\n",
    "    data_row.append((item[13] - c_13_min)/(c_13_max - c_13_min))\n",
    "    data_row.append(((1/item[14]) * 100)/(c_14_max - c_14_min))\n",
    "    data_row.append((item[15] - c_15_min)/(c_15_max - c_15_min))\n",
    "    data_row.append((item[16] - c_16_min)/(c_16_max - c_16_min))\n",
    "    data_row.append((item[17] - c_17_min)/(c_17_max - c_17_min))\n",
    "    data_row.append((item[18] - c_18_min)/(c_18_max - c_18_min))\n",
    "    data_row.append((item[19] - c_19_min)/(c_19_max - c_19_min))\n",
    "    data_row.append((item[20] - c_20_min)/(c_20_max - c_20_min))\n",
    "    data_row.append((item[21] - c_21_min)/(c_21_max - c_21_min))\n",
    "    data_row.append((item[22] - c_22_min)/(c_22_max - c_22_min))\n",
    "    data_row.append((item[23] - c_23_min)/(c_23_max - c_23_min))\n",
    "    data_row.append((item[24] - c_24_min)/(c_24_max - c_24_min))\n",
    "    data_row.append(item[25])\n",
    "    return data_row"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "for item in data_five:\n",
    "    data_all.append(preHandleData_L26_v2(item))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "#for d in data_all:\n",
    "#    print(d)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "for item in data_four:\n",
    "    data_all.append(preHandleData_L26_v2(item))\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "for item in data_three:\n",
    "    data_all.append(preHandleData_L26_v2(item))\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "for item in data_two:\n",
    "    data_all.append(preHandleData_L26_v2(item))\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "for item in data_one:\n",
    "    data_all.append(preHandleData_L26_v2(item))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "column_names = ['index', 'c_1', 'c_2', 'c_3', 'c_4', 'c_5', 'c_6', 'c_7', 'c_8', 'c_9', 'c_10', 'c_11', 'c_12', 'c_13', 'c_14', 'c_15', 'c_16', 'c_17', 'c_18', 'c_19', 'c_20', 'c_21', 'c_22', 'c_23', 'c_24', 'level']\n",
    "df = pd.DataFrame(data_all, columns=column_names)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 500 entries, 0 to 499\n",
      "Data columns (total 26 columns):\n",
      " #   Column  Non-Null Count  Dtype  \n",
      "---  ------  --------------  -----  \n",
      " 0   index   500 non-null    int64  \n",
      " 1   c_1     500 non-null    float64\n",
      " 2   c_2     500 non-null    float64\n",
      " 3   c_3     500 non-null    float64\n",
      " 4   c_4     500 non-null    float64\n",
      " 5   c_5     500 non-null    float64\n",
      " 6   c_6     500 non-null    float64\n",
      " 7   c_7     500 non-null    float64\n",
      " 8   c_8     500 non-null    float64\n",
      " 9   c_9     500 non-null    float64\n",
      " 10  c_10    500 non-null    float64\n",
      " 11  c_11    500 non-null    float64\n",
      " 12  c_12    500 non-null    float64\n",
      " 13  c_13    500 non-null    float64\n",
      " 14  c_14    500 non-null    float64\n",
      " 15  c_15    500 non-null    float64\n",
      " 16  c_16    500 non-null    float64\n",
      " 17  c_17    500 non-null    float64\n",
      " 18  c_18    500 non-null    float64\n",
      " 19  c_19    500 non-null    float64\n",
      " 20  c_20    500 non-null    float64\n",
      " 21  c_21    500 non-null    float64\n",
      " 22  c_22    500 non-null    float64\n",
      " 23  c_23    500 non-null    float64\n",
      " 24  c_24    500 non-null    float64\n",
      " 25  level   500 non-null    int64  \n",
      "dtypes: float64(24), int64(2)\n",
      "memory usage: 101.7 KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>index</th>\n",
       "      <th>c_1</th>\n",
       "      <th>c_2</th>\n",
       "      <th>c_3</th>\n",
       "      <th>c_4</th>\n",
       "      <th>c_5</th>\n",
       "      <th>c_6</th>\n",
       "      <th>c_7</th>\n",
       "      <th>c_8</th>\n",
       "      <th>c_9</th>\n",
       "      <th>...</th>\n",
       "      <th>c_16</th>\n",
       "      <th>c_17</th>\n",
       "      <th>c_18</th>\n",
       "      <th>c_19</th>\n",
       "      <th>c_20</th>\n",
       "      <th>c_21</th>\n",
       "      <th>c_22</th>\n",
       "      <th>c_23</th>\n",
       "      <th>c_24</th>\n",
       "      <th>level</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0.032338</td>\n",
       "      <td>0.943747</td>\n",
       "      <td>0.138268</td>\n",
       "      <td>0.491022</td>\n",
       "      <td>0.482839</td>\n",
       "      <td>0.144448</td>\n",
       "      <td>0.999360</td>\n",
       "      <td>0.922294</td>\n",
       "      <td>0.544342</td>\n",
       "      <td>...</td>\n",
       "      <td>0.124190</td>\n",
       "      <td>0.158109</td>\n",
       "      <td>0.359095</td>\n",
       "      <td>0.400220</td>\n",
       "      <td>0.106130</td>\n",
       "      <td>0.406389</td>\n",
       "      <td>0.709344</td>\n",
       "      <td>0.119939</td>\n",
       "      <td>0.906655</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>0.006840</td>\n",
       "      <td>0.766575</td>\n",
       "      <td>0.200264</td>\n",
       "      <td>0.999983</td>\n",
       "      <td>0.607805</td>\n",
       "      <td>0.207144</td>\n",
       "      <td>0.687347</td>\n",
       "      <td>0.160545</td>\n",
       "      <td>0.217183</td>\n",
       "      <td>...</td>\n",
       "      <td>0.888981</td>\n",
       "      <td>0.697986</td>\n",
       "      <td>0.413988</td>\n",
       "      <td>0.751796</td>\n",
       "      <td>0.609922</td>\n",
       "      <td>0.438785</td>\n",
       "      <td>0.102184</td>\n",
       "      <td>0.340052</td>\n",
       "      <td>0.335686</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>0.007036</td>\n",
       "      <td>0.833283</td>\n",
       "      <td>0.738341</td>\n",
       "      <td>0.243420</td>\n",
       "      <td>0.636778</td>\n",
       "      <td>0.719134</td>\n",
       "      <td>0.235687</td>\n",
       "      <td>0.924131</td>\n",
       "      <td>0.778112</td>\n",
       "      <td>...</td>\n",
       "      <td>0.976987</td>\n",
       "      <td>0.708086</td>\n",
       "      <td>0.521218</td>\n",
       "      <td>0.748476</td>\n",
       "      <td>0.688100</td>\n",
       "      <td>0.127775</td>\n",
       "      <td>0.649340</td>\n",
       "      <td>0.510221</td>\n",
       "      <td>0.456179</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>0.007461</td>\n",
       "      <td>0.426474</td>\n",
       "      <td>0.979043</td>\n",
       "      <td>0.337244</td>\n",
       "      <td>0.945619</td>\n",
       "      <td>0.645383</td>\n",
       "      <td>0.917583</td>\n",
       "      <td>0.115921</td>\n",
       "      <td>0.951190</td>\n",
       "      <td>...</td>\n",
       "      <td>0.988862</td>\n",
       "      <td>0.116265</td>\n",
       "      <td>0.826834</td>\n",
       "      <td>0.633864</td>\n",
       "      <td>0.838766</td>\n",
       "      <td>0.813599</td>\n",
       "      <td>0.846893</td>\n",
       "      <td>0.154719</td>\n",
       "      <td>0.838639</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0.106016</td>\n",
       "      <td>0.170507</td>\n",
       "      <td>0.477478</td>\n",
       "      <td>0.166241</td>\n",
       "      <td>0.552545</td>\n",
       "      <td>0.653953</td>\n",
       "      <td>0.402337</td>\n",
       "      <td>0.431635</td>\n",
       "      <td>0.680597</td>\n",
       "      <td>...</td>\n",
       "      <td>0.175483</td>\n",
       "      <td>0.760372</td>\n",
       "      <td>0.605277</td>\n",
       "      <td>0.467538</td>\n",
       "      <td>0.180372</td>\n",
       "      <td>0.338085</td>\n",
       "      <td>0.456177</td>\n",
       "      <td>0.120116</td>\n",
       "      <td>0.656110</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 26 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   index       c_1       c_2       c_3       c_4       c_5       c_6  \\\n",
       "0      1  0.032338  0.943747  0.138268  0.491022  0.482839  0.144448   \n",
       "1      2  0.006840  0.766575  0.200264  0.999983  0.607805  0.207144   \n",
       "2      3  0.007036  0.833283  0.738341  0.243420  0.636778  0.719134   \n",
       "3      4  0.007461  0.426474  0.979043  0.337244  0.945619  0.645383   \n",
       "4      5  0.106016  0.170507  0.477478  0.166241  0.552545  0.653953   \n",
       "\n",
       "        c_7       c_8       c_9  ...      c_16      c_17      c_18      c_19  \\\n",
       "0  0.999360  0.922294  0.544342  ...  0.124190  0.158109  0.359095  0.400220   \n",
       "1  0.687347  0.160545  0.217183  ...  0.888981  0.697986  0.413988  0.751796   \n",
       "2  0.235687  0.924131  0.778112  ...  0.976987  0.708086  0.521218  0.748476   \n",
       "3  0.917583  0.115921  0.951190  ...  0.988862  0.116265  0.826834  0.633864   \n",
       "4  0.402337  0.431635  0.680597  ...  0.175483  0.760372  0.605277  0.467538   \n",
       "\n",
       "       c_20      c_21      c_22      c_23      c_24  level  \n",
       "0  0.106130  0.406389  0.709344  0.119939  0.906655      5  \n",
       "1  0.609922  0.438785  0.102184  0.340052  0.335686      5  \n",
       "2  0.688100  0.127775  0.649340  0.510221  0.456179      5  \n",
       "3  0.838766  0.813599  0.846893  0.154719  0.838639      5  \n",
       "4  0.180372  0.338085  0.456177  0.120116  0.656110      5  \n",
       "\n",
       "[5 rows x 26 columns]"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>index</th>\n",
       "      <th>c_1</th>\n",
       "      <th>c_2</th>\n",
       "      <th>c_3</th>\n",
       "      <th>c_4</th>\n",
       "      <th>c_5</th>\n",
       "      <th>c_6</th>\n",
       "      <th>c_7</th>\n",
       "      <th>c_8</th>\n",
       "      <th>c_9</th>\n",
       "      <th>...</th>\n",
       "      <th>c_16</th>\n",
       "      <th>c_17</th>\n",
       "      <th>c_18</th>\n",
       "      <th>c_19</th>\n",
       "      <th>c_20</th>\n",
       "      <th>c_21</th>\n",
       "      <th>c_22</th>\n",
       "      <th>c_23</th>\n",
       "      <th>c_24</th>\n",
       "      <th>level</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>190</th>\n",
       "      <td>191</td>\n",
       "      <td>0.005698</td>\n",
       "      <td>0.091523</td>\n",
       "      <td>0.078765</td>\n",
       "      <td>0.077713</td>\n",
       "      <td>0.092493</td>\n",
       "      <td>0.081816</td>\n",
       "      <td>0.084842</td>\n",
       "      <td>0.090678</td>\n",
       "      <td>0.090079</td>\n",
       "      <td>...</td>\n",
       "      <td>0.085508</td>\n",
       "      <td>0.087801</td>\n",
       "      <td>0.091152</td>\n",
       "      <td>0.090667</td>\n",
       "      <td>0.085919</td>\n",
       "      <td>0.091814</td>\n",
       "      <td>0.084546</td>\n",
       "      <td>0.095994</td>\n",
       "      <td>0.09667</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1 rows × 26 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     index       c_1       c_2       c_3       c_4       c_5       c_6  \\\n",
       "190    191  0.005698  0.091523  0.078765  0.077713  0.092493  0.081816   \n",
       "\n",
       "          c_7       c_8       c_9  ...      c_16      c_17      c_18  \\\n",
       "190  0.084842  0.090678  0.090079  ...  0.085508  0.087801  0.091152   \n",
       "\n",
       "         c_19      c_20      c_21      c_22      c_23     c_24  level  \n",
       "190  0.090667  0.085919  0.091814  0.084546  0.095994  0.09667      4  \n",
       "\n",
       "[1 rows x 26 columns]"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sample()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "level Counter({5: 100, 4: 100, 3: 100, 2: 100, 1: 100})\n"
     ]
    }
   ],
   "source": [
    "from collections import Counter\n",
    "\n",
    "print('level', Counter(df['level']))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = df['level']\n",
    "X = df.iloc[:, 1:-1]\n",
    "\n",
    "X, y = su.shuffle(X, y, random_state=7)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.4, random_state=123)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "param_grid = {\n",
    "    'criterion': ['entropy','gini'],\n",
    "    'n_estimators': [100, 200, 400, 800, 1200],\n",
    "    'max_features': ['sqrt'],\n",
    "    'max_depth': [4,5,6,7,8],\n",
    "    'min_samples_split': [4, 8, 12, 16, 20, 24, 28] }\n",
    "\n",
    "#param_grid_rfr = {\n",
    "#    'criterion': ['mse','mae'],\n",
    "#    'n_estimators': [100, 200, 400, 800, 1200],\n",
    "#    'max_features': ['sqrt'],\n",
    "#    'max_depth': [4,5,6,7,8],\n",
    "#    'min_samples_split': [4, 8, 12, 16, 20, 24, 28] }\n",
    "\n",
    "\n",
    "param_grid_rfr = {\n",
    "    'criterion': ['mae', 'mse'],\n",
    "    'n_estimators': [800, 1000],\n",
    "    'max_features': ['sqrt'],\n",
    "    'max_depth': [4, 5],\n",
    "    'min_samples_split': [8, 12, 16] }\n",
    "\n",
    "\n",
    "param_grid_rfr_best = {\n",
    "    'criterion': ['mae', 'mse'],\n",
    "    'n_estimators': [800, 1000],\n",
    "    'max_features': ['sqrt'],\n",
    "    'max_depth': [4, 5],\n",
    "    'min_samples_split': [8, 12, 16] }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "# rfc = ensemble.RandomForestClassifier()\n",
    "\n",
    "rfr = ensemble.RandomForestRegressor()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=5, estimator=RandomForestRegressor(),\n",
       "             param_grid={'criterion': ['mae', 'mse'], 'max_depth': [4, 5],\n",
       "                         'max_features': ['sqrt'],\n",
       "                         'min_samples_split': [8, 12, 16],\n",
       "                         'n_estimators': [800, 1000]},\n",
       "             scoring='r2')"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rfr_cv = GridSearchCV(estimator=rfr, param_grid=param_grid_rfr_best, scoring='r2', cv=5)\n",
    "\n",
    "#rfc_cv = GridSearchCV(estimator=rfc, param_grid=param_grid, cv=4)\n",
    "\n",
    "# start time\n",
    "print(time.strftime(\"start: %Y-%m-%d %H:%M:%S\", time.localtime()))\n",
    "\n",
    "rfr_cv.fit(X_train, y_train)\n",
    "\n",
    "# end time\n",
    "print(time.strftime(\"end: %Y-%m-%d %H:%M:%S\", time.localtime()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "start: 2020-11-03 21:06:02\n",
      "交叉验证得分: 0.9997\n",
      "end: 2020-11-03 21:25:12\n"
     ]
    }
   ],
   "source": [
    "print(time.strftime(\"start: %Y-%m-%d %H:%M:%S\", time.localtime()))\n",
    "\n",
    "score_nmse = cross_val_score(rfr_cv, X_test, y_test, scoring='neg_mean_squared_error', cv=10).mean()\n",
    "print('交叉验证得分: %.4f'%score)\n",
    "\n",
    "print(time.strftime(\"end: %Y-%m-%d %H:%M:%S\", time.localtime()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MSE:  0.00030618999999999964\n",
      "MSE(直接计算) 0.00030618999999999964\n",
      "RMSE:  0.017498285630312464\n",
      "R2:  0.9998440908396558\n",
      "NMSE:  0.00015590916034421287\n"
     ]
    }
   ],
   "source": [
    "y_pred = rfr_cv.predict(X_test)\n",
    "\n",
    "from sklearn.metrics import mean_squared_error\n",
    "from sklearn.metrics import r2_score\n",
    "\n",
    "print('MSE: ', mean_squared_error(y_test, y_pred))\n",
    "print('MSE(直接计算)', np.mean((y_test-y_pred)**2))\n",
    "print('RMSE: ', np.sqrt(mean_squared_error(y_test, y_pred)))\n",
    "print('R2: ', r2_score(y_test, y_pred))\n",
    "\n",
    "y_test_mean = np.array([np.mean(y_test)] * len(y_pred))\n",
    "print('NMSE: ', (np.sum((y_pred-y_test)**2)/(np.sum((y_test-y_test_mean)**2))))\n",
    "#print(y_pred_mean)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'criterion': 'mae',\n",
       " 'max_depth': 4,\n",
       " 'max_features': 'sqrt',\n",
       " 'min_samples_split': 12,\n",
       " 'n_estimators': 1000}"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rfr_cv.best_params_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9998530930985619"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rfr_cv.best_score_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 交叉验证\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "随机森林回归的默认评估值为： 0.9997869470130981\n",
      "随机森林回归的R_squared值为： 0.9997869470130981\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import r2_score, mean_squared_error\n",
    "\n",
    "rfr_predict = rfr_cv.predict(X_test)\n",
    "rfr_predict_probe = rfr_cv.predict_proba(X_test)\n",
    "print(\"随机森林回归的默认评估值为：\", rfr_cv.score(X_test, y_test))\n",
    "print(\"随机森林回归的R_squared值为：\", r2_score(y_test, rfr_predict))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 归一化处理，length=24\n",
    "def preHandleData(data):\n",
    "    data_res = []\n",
    "    data_res.append((c_1_max - data[0])/(c_1_max - c_1_min)) # 负向\n",
    "    data_res.append((data[1] - c_2_min)/(c_2_max - c_2_min)) # 正向\n",
    "    data_res.append((data[2] - c_3_min)/(c_3_max - c_3_min))\n",
    "    data_res.append((data[3] - c_4_min)/(c_4_max - c_4_min))\n",
    "    data_res.append((data[4] - c_5_min)/(c_5_max - c_5_min))\n",
    "    data_res.append((data[5] - c_6_min)/(c_6_max - c_6_min))\n",
    "    data_res.append((data[6] - c_7_min)/(c_7_max - c_7_min))\n",
    "    data_res.append((data[7] - c_8_min)/(c_8_max - c_8_min))\n",
    "    data_res.append((data[8] - c_9_min)/(c_9_max - c_9_min))\n",
    "    data_res.append((c_10_max - data[9])/(c_10_max - c_10_min))\n",
    "    data_res.append((data[10] - c_11_min)/(c_11_max - c_11_min))\n",
    "    data_res.append((c_12_max - data[11])/(c_12_max - c_12_min))\n",
    "    data_res.append((data[12] - c_13_min)/(c_13_max - c_13_min))\n",
    "    data_res.append((c_14_max - data[13])/(c_14_max - c_14_min))\n",
    "    data_res.append((data[14] - c_15_min)/(c_15_max - c_15_min))\n",
    "    data_res.append((data[15] - c_16_min)/(c_16_max - c_16_min))\n",
    "    data_res.append((data[16] - c_17_min)/(c_17_max - c_17_min))\n",
    "    data_res.append((data[17] - c_18_min)/(c_18_max - c_18_min))\n",
    "    data_res.append((data[18] - c_19_min)/(c_19_max - c_19_min))\n",
    "    data_res.append((data[19] - c_20_min)/(c_20_max - c_20_min))\n",
    "    data_res.append((data[20] - c_21_min)/(c_21_max - c_21_min))\n",
    "    data_res.append((data[21] - c_22_min)/(c_22_max - c_22_min))\n",
    "    data_res.append((data[22] - c_23_min)/(c_23_max - c_23_min))\n",
    "    data_res.append((data[23] - c_24_min)/(c_24_max - c_24_min))\n",
    "    return data_res\n",
    "\n",
    "# 按照论文内的处理方式进行处理\n",
    "def preHandleData_v2(data):\n",
    "    data_res = []\n",
    "    data_res.append(((1/data[0])*100 - c_1_min)/(c_1_max - c_1_min)) # 负向\n",
    "    data_res.append((data[1] - c_2_min)/(c_2_max - c_2_min)) # 正向\n",
    "    data_res.append((data[2] - c_3_min)/(c_3_max - c_3_min))\n",
    "    data_res.append((data[3] - c_4_min)/(c_4_max - c_4_min))\n",
    "    data_res.append((data[4] - c_5_min)/(c_5_max - c_5_min))\n",
    "    data_res.append((data[5] - c_6_min)/(c_6_max - c_6_min))\n",
    "    data_res.append((data[6] - c_7_min)/(c_7_max - c_7_min))\n",
    "    data_res.append((data[7] - c_8_min)/(c_8_max - c_8_min))\n",
    "    data_res.append((data[8] - c_9_min)/(c_9_max - c_9_min))\n",
    "    data_res.append(((1/data[9])*100 - c_10_min)/(c_10_max - c_10_min))\n",
    "    data_res.append((data[10] - c_11_min)/(c_11_max - c_11_min))\n",
    "    data_res.append(((1/data[11])*100 - c_12_min)/(c_12_max - c_12_min))\n",
    "    data_res.append((data[12] - c_13_min)/(c_13_max - c_13_min))\n",
    "    data_res.append(((1/data[13])*100 - c_14_min)/(c_14_max - c_14_min))\n",
    "    data_res.append((data[14] - c_15_min)/(c_15_max - c_15_min))\n",
    "    data_res.append((data[15] - c_16_min)/(c_16_max - c_16_min))\n",
    "    data_res.append((data[16] - c_17_min)/(c_17_max - c_17_min))\n",
    "    data_res.append((data[17] - c_18_min)/(c_18_max - c_18_min))\n",
    "    data_res.append((data[18] - c_19_min)/(c_19_max - c_19_min))\n",
    "    data_res.append((data[19] - c_20_min)/(c_20_max - c_20_min))\n",
    "    data_res.append((data[20] - c_21_min)/(c_21_max - c_21_min))\n",
    "    data_res.append((data[21] - c_22_min)/(c_22_max - c_22_min))\n",
    "    data_res.append((data[22] - c_23_min)/(c_23_max - c_23_min))\n",
    "    data_res.append((data[23] - c_24_min)/(c_24_max - c_24_min))\n",
    "    return data_res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "level 5: >4.017\n",
      "level 4: (3.392, 4.017]\n",
      "level 3: (2.508, 3.392]\n",
      "level 2: (1.594, 2.508]\n",
      "level 1: <1.594\n",
      "2015: 3.149\n",
      "2020: 3.568\n",
      "2030: 4.036\n"
     ]
    }
   ],
   "source": [
    "data_2015 = [7.0, 0.964, 51, 4781, 80, 75, 5, 50, 60, 4.5, 80, 30, 100, 60, 80, 0.52, 80, 70, 60, 50, 85, 70, 40, 50]\n",
    "\n",
    "data_2020 = [8.1, 0.946, 49, 4275, 90, 80, 8, 75, 80, 4.8, 85, 35, 100, 42, 95, 0.60, 90, 80, 80, 80, 90, 80, 70, 80]\n",
    "\n",
    "data_2030 = [8.5, 0.913, 47, 4068, 100, 95, 10, 85, 95, 5.5, 90, 40, 100, 30, 100, 0.70, 95, 90, 95, 95, 95, 95, 90, 95]\n",
    "\n",
    "\n",
    "data_limit_5 = [20, 0.95, 80, 5000, 95, 95, 20, 90, 90, 2, 80, 10, 90, 20, 90, 0.7, 95, 80, 90, 90, 95, 90, 80, 90]\n",
    "data_limit_4 = [40, 0.9, 60, 4000, 80, 80, 15, 75, 80, 4, 60, 20, 80, 40, 80, 0.6, 80, 60, 80, 80, 85, 80, 60, 80]\n",
    "data_limit_3 = [60, 0.85, 40, 3000, 60, 60, 10, 60, 70, 6, 40, 40, 70, 60, 70, 0.5, 60, 40, 70, 70, 70, 70, 40, 60]\n",
    "data_limit_2 = [80, 0.8, 20, 2000, 40, 40, 5, 30, 50, 10, 20, 60, 50, 80, 50, 0.4, 40, 20, 40, 40, 40, 50, 20, 30]\n",
    "\n",
    "#data_5 = preHandleData(data_limit_5)\n",
    "#data_4 = preHandleData(data_limit_4)\n",
    "#data_3 = preHandleData(data_limit_3)\n",
    "#data_2 = preHandleData(data_limit_2)\n",
    "\n",
    "data_5 = preHandleData_v2(data_limit_5)\n",
    "data_4 = preHandleData_v2(data_limit_4)\n",
    "data_3 = preHandleData_v2(data_limit_3)\n",
    "data_2 = preHandleData_v2(data_limit_2)\n",
    "\n",
    "pre_5 = rfr_cv.predict([data_5])\n",
    "pre_4 = rfr_cv.predict([data_4])\n",
    "pre_3 = rfr_cv.predict([data_3])\n",
    "pre_2 = rfr_cv.predict([data_2])\n",
    "\n",
    "#print(\"<5> \" + str(pre_5[0]) + \" <4> \" + str(pre_4[0]) + \" <3> \" + str(pre_3[0]) + \" <2> \" + str(pre_2[0]) + \" <1>\")\n",
    "print(\"level 5: >\" + str(pre_5[0]))\n",
    "print(\"level 4: (\" + str(pre_4[0]) + \", \" + str(pre_5[0]) + \"]\")\n",
    "print(\"level 3: (\" + str(pre_3[0]) + \", \" + str(pre_4[0]) + \"]\")\n",
    "print(\"level 2: (\" + str(pre_2[0]) + \", \" + str(pre_3[0]) + \"]\")\n",
    "print(\"level 1: <\" + str(pre_2[0]))\n",
    "\n",
    "#data_2015_2 = preHandleData(data_2015)\n",
    "#data_2020_2 = preHandleData(data_2020)\n",
    "#data_2030_2 = preHandleData(data_2030)\n",
    "\n",
    "data_2015_2 = preHandleData_v2(data_2015)\n",
    "data_2020_2 = preHandleData_v2(data_2020)\n",
    "data_2030_2 = preHandleData_v2(data_2030)\n",
    "\n",
    "pre_2015 = rfr_cv.predict([data_2015_2])\n",
    "pre_2020 = rfr_cv.predict([data_2020_2])\n",
    "pre_2030 = rfr_cv.predict([data_2030_2])\n",
    "\n",
    "print(\"2015: \" + str(pre_2015[0]))\n",
    "print(\"2020: \" + str(pre_2020[0]))\n",
    "print(\"2030: \" + str(pre_2030[0]))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(50):\n",
    "    data_readyed = getReadyData()\n",
    "    yData = data_readyed['level']\n",
    "    XData = data_readyed.iloc[:, 1:-1]\n",
    "    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.4, random_state=123)\n",
    "    rfr_cv.fit(X_train, y_train)\n",
    "    // 验证\n",
    "    mean_abs_error = \n",
    "    r2_score = \n",
    "    mean_sq_error = \n",
    "    \n",
    "    // 模拟计算，范围\n",
    "    pre_5 = rfr_cv.predict([data_5])\n",
    "    pre_4 = rfr_cv.predict([data_4])\n",
    "    pre_3 = rfr_cv.predict([data_3])\n",
    "    pre_2 = rfr_cv.predict([data_2])\n",
    "    \n",
    "    // 预测值\n",
    "    predict_2015 = rfr_cv.predict([data_2015_2])[0]\n",
    "    predict_2020 = rfr_cv.predict([data_2020_2])[0]\n",
    "    predict_2030 = rfr_cv.predict([data_2030_2])[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 178,
   "metadata": {},
   "outputs": [],
   "source": [
    "def preHandleReadyData(data):\n",
    "    data_res = []\n",
    "    for item in data:\n",
    "        data_row = []\n",
    "        data_row.append(item[0])\n",
    "        data_row.append((c_1_max - item[1])/(c_1_max - c_1_min)) # 负向\n",
    "        data_row.append((item[2] - c_2_min)/(c_2_max - c_2_min)) # 正向\n",
    "        data_row.append((item[3] - c_3_min)/(c_3_max - c_3_min))\n",
    "        data_row.append((item[4] - c_4_min)/(c_4_max - c_4_min))\n",
    "        data_row.append((item[5] - c_5_min)/(c_5_max - c_5_min))\n",
    "        data_row.append((item[6] - c_6_min)/(c_6_max - c_6_min))\n",
    "        data_row.append((item[7] - c_7_min)/(c_7_max - c_7_min))\n",
    "        data_row.append((item[8] - c_8_min)/(c_8_max - c_8_min))\n",
    "        data_row.append((item[9] - c_9_min)/(c_9_max - c_9_min))\n",
    "        data_row.append((c_10_max - item[10])/(c_10_max - c_10_min))\n",
    "        data_row.append((item[11] - c_11_min)/(c_11_max - c_11_min))\n",
    "        data_row.append((c_12_max - item[12])/(c_12_max - c_12_min))\n",
    "        data_row.append((item[13] - c_13_min)/(c_13_max - c_13_min))\n",
    "        data_row.append((c_14_max - item[14])/(c_14_max - c_14_min))\n",
    "        data_row.append((item[15] - c_15_min)/(c_15_max - c_15_min))\n",
    "        data_row.append((item[16] - c_16_min)/(c_16_max - c_16_min))\n",
    "        data_row.append((item[17] - c_17_min)/(c_17_max - c_17_min))\n",
    "        data_row.append((item[18] - c_18_min)/(c_18_max - c_18_min))\n",
    "        data_row.append((item[19] - c_19_min)/(c_19_max - c_19_min))\n",
    "        data_row.append((item[20] - c_20_min)/(c_20_max - c_20_min))\n",
    "        data_row.append((item[21] - c_21_min)/(c_21_max - c_21_min))\n",
    "        data_row.append((item[22] - c_22_min)/(c_22_max - c_22_min))\n",
    "        data_row.append((item[23] - c_23_min)/(c_23_max - c_23_min))\n",
    "        data_row.append((item[24] - c_24_min)/(c_24_max - c_24_min))\n",
    "        data_row.append(item[25])\n",
    "        data_res.append(data_row)\n",
    "    return data_res\n",
    "\n",
    "def getReadyData():\n",
    "    data_final = []\n",
    "    data_l5 = getLevelFiveData_v2(100, 1)\n",
    "    data_l5 = preHandleReadyData(data_l5)\n",
    "    data_l4 = getLevelFourData_v2(100, 101)\n",
    "    data_l4 = preHandleReadyData(data_l4)\n",
    "    data_l3 = getLevelThreeData_v2(100, 201)\n",
    "    data_l3 = preHandleReadyData(data_l3)\n",
    "    data_l2 = getLevelTwoData_v2(100, 301)\n",
    "    data_l2 = preHandleReadyData(data_l2)\n",
    "    data_l1 = getLevelOneData_v2(100, 401)\n",
    "    data_l1 = preHandleReadyData(data_l1)\n",
    "    for item in data_l5:\n",
    "        data_final.append(item)\n",
    "    for item in data_l4:\n",
    "        data_final.append(item)\n",
    "    for item in data_l3:\n",
    "        data_final.append(item)\n",
    "    for item in data_l2:\n",
    "        data_final.append(item)\n",
    "    for item in data_l1:\n",
    "        data_final.append(item)\n",
    "    \n",
    "    return pd.DataFrame(data_final, column_names)\n",
    "\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "    "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
